Next.js Discord

Discord Forum

Handling redirect error

Unanswered
Sun bear posted this in #help-forum
Open in Discord
Avatar
Sun bearOP
response.then((value) => {
    if (value.status == 200) {
      const cookieStore = cookies();
      cookieStore.set("email", email);
      cookieStore.set("pswrd", pswrd);
      console.log(cookieStore.getAll());
    } else if (value.status == 404) {
      return redirect(`/register`);
    } else {
      console.log("check netwrking tab ;)");
    }
  });

2 Replies

Avatar
Sun bearOP
unhandledRejection: Error: NEXT_REDIRECT
    at getRedirectError (webpack-internal:///(rsc)/./node_modules/next/dist/client/components/redirect.js:49:19)
    at redirect (webpack-internal:///(rsc)/./node_modules/next/dist/client/components/redirect.js:60:11)
    at eval (webpack-internal:///(rsc)/./app/login/page.tsx:42:77)
how would one go around this issue