- From: Santiago Miranda <notifications@github.com>
- Date: Thu, 17 Dec 2020 00:50:38 -0800
- To: whatwg/fetch <fetch@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Thursday, 17 December 2020 08:50:50 UTC
Sorry, I'm a newbie and have been dealing with this for days, and having partial or wrong answers in stackoverflow. I'm creating a login page, where I prevent the form default to deal with it using fetch, like this: ``` const fetchOptions = data => { return { method: 'POST', mode: 'cors', cache: 'no-cache', credentials: 'include', headers: { 'Content-Type': 'application/json' }, redirect: 'follow', referrerPolicy: 'no-referrer', body: JSON.stringify(data) }} form.addEventListener("submit", (e) => { e.preventDefault() fetch(uri, fetchOptions({ "username":user.value, "password":pwd.value })).catch(e => console.log(e)) }) ``` When the redirected response arrives (which I can see in the network tab), the page stays in `/login`. Just for completeness, this is the redirect in pseudocode: ``` app.post("/login", (req,req)=>{ ("if credentials correct")=>res.redirect(303, "/") } ``` I've exhausted the MDN for answers, but no answer to this. Is this behaviour expected? -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/whatwg/fetch/issues/1129
Received on Thursday, 17 December 2020 08:50:50 UTC