Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function login()
- {
- let user = document.getElementById("username").value;
- let password = document.getElementById("password").value;
- get_aws_token(user,password)
- }
- async function get_aws_token(user,password)
- {
- data = {'username': user, 'password':password };
- let myAuth = await fetch('https://74uszeihka.execute-api.ap-southeast-2.amazonaws.com/prod/auth',
- {
- method: 'PUT',
- headers: { 'content-Type': 'application/json'},
- credentials: 'same-origin',
- body: JSON.stringify(data),
- });
- let myResponse = await myAuth.json();
- document.getElementById("debugline").innerHTML = myResponse.status;
- if (myResponse.status="success")
- {
- document.getElementById("outputtext").innerHTML = "Thanks, You have logged in successfully";
- }
- else if (myResponse.status="fail")
- {
- document.getElementById("outputtext").innerHTML = "Mmm. you did'nt get the right";
- }
- else
- {
- document.getElementById("outputtext").innerHTML = "Im sorry, I'm broken"
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement