How to order a web page to show it

1

My application uses token-based authentication. On the login page, I send the user's data and password. I must receive a token to set it to localStorage . once it is received and established. render the welcome page.

This is my Front end code

const formDataSignin = new FormData(formSignin);
event.preventDefault();
const header =
{
   method: 'post',
   body: formDataSignin
}

fetch('/signin', header)
.then(res => res.json())
.then(res =>
 {
  localStorage.setItem('token', res.token);
 });

My back End code

const newToken = token.createToken(answer);
res.render(user, {token, newToken})
return;
    
asked by José Llamas 25.01.2018 в 15:56
source

0 answers