Advertisement
Guest User

Untitled

a guest
Apr 6th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import {userPoolId, clientId} from './env.js'
  2. import {CognitoUserPool} from 'amazon-cognito-identity-js'
  3.  
  4. var userPoolData = {
  5.     UserPoolId : userPoolId,
  6.     ClientId   : clientId
  7. }
  8.    
  9. const userPool = new CognitoUserPool(userPoolData)
  10.  
  11. const helloBtn = document.querySelector('#hello')
  12.  
  13. helloBtn.addEventListener('click', ()=> {
  14.     alert("No siema ziomeczki")
  15. })
  16.  
  17. const bob = {
  18.     userName: 'imiÄ™',
  19.     password: '123qwe',
  20.     email: 'jakub.kanclerz+testbob@gmail.com'
  21. }
  22.  
  23. const handleRegistration = (rRequest) => {
  24.     userPool.signUp(
  25.         rRequest.username,
  26.         rRequest.password,
  27.         [],
  28.         null,
  29.         (err, result) => {
  30.             if(err){
  31.                 alert(err.message);
  32.                 return;
  33.             }
  34.            
  35.             console.log('yaay ${rRequest.userName} is registered');
  36.         }
  37.     )
  38. }
  39.  
  40.  
  41. const registerBtn = document.querySelector('#testRegister')
  42.  
  43. registerBtn.addEventListener('click', ()=> {
  44.     const rRequest = {
  45.         userName: bob.userName,
  46.         password: bob.password
  47.     }
  48.     handleRegistration(rRequest)
  49. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement