Redirect error in route handlers
Unanswered
Mouad posted this in #help-forum
MouadOP
I'm facing this error when I want to redirect user to another page
this is the code
js
error: Object
digest: "NEXT_REDIRECT;replace;/dashboard;false"
mutableCookies: {_parsed: {}, _headers: {}}this is the code
export async function POST(req: Request) {
...
const newUser = await db.user.create({
...
redirect("/dashboard");
} catch (error) {
return NextResponse.json({ error: error });
}
}