Redirect ask for single argument while i'm using only one argument......
Answered
Ninhache posted this in #help-forum
NinhacheOP
According to the documentation : https://nextjs.org/docs/app/api-reference/functions/redirect#redirect
We can use a function called
I'm currently using it like in the documentation but.. for no reason, i'm getting a runtime error now (See my screen) :
(Looks like it's lower level.. but anyways)
Any body ever see it ? i cannot reproduce the bug tho..
We can use a function called
redirect
in server components :export default async function Component({ params }) {
if (!params.error) {
redirect('/destination')
}
// ...
}
I'm currently using it like in the documentation but.. for no reason, i'm getting a runtime error now (See my screen) :
Error: Invalid redirect arguments. Please use a single argument URL, e.g. res.redirect('/destination') or use a status code and URL, e.g. res.redirect(307, '/destination').
(Looks like it's lower level.. but anyways)
Any body ever see it ? i cannot reproduce the bug tho..
Answered by Ninhache
Hello dumbass, use the right function :D
import { redirect } from "next/dist/server/api-utils";
import { redirect } from "next/navigation";
import { redirect } from "next/navigation";