Next.js Discord

Discord Forum

Error NEXT_REDIRECT

Unanswered
Bigheaded ant posted this in #help-forum
Open in Discord
Bigheaded antOP
Hello everyone, is there anyone here ever occured this error? how we can fix it? So I just want to redirect to the dashboard after user logged in.

5 Replies

Bigheaded antOP
This is my code.
    async function onSubmit(data: LoginFormType){
        setLoading(true)
        const toasId = toast({
            title: "Your request on progress.",
            description: "Please kindly wait.",
        })

        const response = await login(data)
        
        toasId.dismiss()
        toast({
            title: response.status ? "Login successfully" : "Login Failed",
            description: !response.status ? response.message :"You have successfully logged in",
            variant: response.status ? "default" : "destructive"
        })
        setLoading(false)
        if(response.status) permanentRedirect('/dashboard');
    }
Upp
Bigheaded antOP
Upp