I would like to redirect the user to a new webpage after a fetch() function. I use a facebook login button and when the user is authenticated, I would like to redirect him to a new page with his datas. So I would like to know what's the best method to do it.
I thought a window.location + a session variable could work but I'm pretty sure that there is something more correct than this method, something like a redirect function after a then() function.
I tired to use the fetch().then().redirect() but it's not working and what I would like to do is something like ...().redirect(function(userDatas, url){...});
//this is inside the facebook connection function
fetch('/connect',options).then(function(response){
response.json().then(function(value){
window.location = 'http://localhost:3000/fight.html';
console.log(value);
});
//after this function, I would like to go to this fight.html page
So I would like the user arrive to the fight.html page after the FB connection with his datas.