Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import {userPoolId, clientId} from './env.js'
- import {CognitoUserPool} from 'amazon-cognito-identity-js'
- var userPoolData = {
- UserPoolId : userPoolId,
- ClientId : clientId
- }
- const userPool = new CognitoUserPool(userPoolData)
- const helloBtn = document.querySelector('#hello')
- helloBtn.addEventListener('click', ()=> {
- alert("No siema ziomeczki")
- })
- const bob = {
- userName: 'imiÄ™',
- password: '123qwe',
- email: 'jakub.kanclerz+testbob@gmail.com'
- }
- const handleRegistration = (rRequest) => {
- userPool.signUp(
- rRequest.username,
- rRequest.password,
- [],
- null,
- (err, result) => {
- if(err){
- alert(err.message);
- return;
- }
- console.log('yaay ${rRequest.userName} is registered');
- }
- )
- }
- const registerBtn = document.querySelector('#testRegister')
- registerBtn.addEventListener('click', ()=> {
- const rRequest = {
- userName: bob.userName,
- password: bob.password
- }
- handleRegistration(rRequest)
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement