Skip to content

Commit

Permalink
redirect working with fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
dcgleason committed Jan 13, 2023
1 parent 2e965dc commit 2ba75e2
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions pages/signin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 2ba75e2

Please sign in to comment.