From 2ba75e27c26f586bbf1b16bbd018d4660a27776a Mon Sep 17 00:00:00 2001 From: Dan Gleason Date: Thu, 12 Jan 2023 19:53:39 -0500 Subject: [PATCH] redirect working with fetch --- pages/signin.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pages/signin.js b/pages/signin.js index 5514798..94c1344 100644 --- a/pages/signin.js +++ b/pages/signin.js @@ -25,16 +25,16 @@ const onSubmit = async e => { try { console.log("body: ", body); // Use fetch to send a POST request to the /signup route - const res = await fetch( - 'http://localhost:3001/login/signin', - { - method: 'POST', - body: body, - headers: config.headers, - } - ); + const res = await fetch('http://localhost:3001/login/signin', { + method: 'POST', + body: body, + headers: config.headers, + redirect: 'follow', + credentials: 'include' +}); - console.log(await res.json()); + console.log("res: ", res); + console.log('res.location' + res.location); } catch (err) { console.error(err); }