Reputation: 11
I am Using clerk Authentication for signIn / SignUp .
this is my redirecting page code :
import { onAuthenticatorUser } from '@/actions/user'
import { redirect } from 'next/dist/server/api-utils';
import React from 'react'
type Props = {}
const AuthCallBackPage = async(props: Props) => {
const auth = await onAuthenticatorUser();
if(auth.status === 200|| auth.status === 201){
return redirect(`/dashboard/${auth.user?.firstname}${auth.user?.lastname}`)
}
if(auth.status === 400 || auth.status === 500 || auth.status === 404){
// return{ redirect:{destination:`/auth/sign-in`}}
return redirect(`/auth/sign-in`)
}
}
// module.exports = Dashboardpage
export default AuthCallBackPage
redirect throwing an error like this :
Expected 2-3 arguments, but got 1.ts(2554)
index.d.ts(28, 56): An argument for 'statusOrUrl' was not provided.
(alias) redirect(res: NextApiResponse, statusOrUrl: string | number, url?: string): NextApiResponse<any>import redirect
@param res — response object
@param statusOrUrl — HTTP status code of redirect
@param url — URL of redirect
After Logging or signUp My url is not going to http://localhost:3000/dashboard/userfirstname/userlastname .
I also tried to redirect with this code
return{ redirect:{destination:`/auth/sign-in`}}
But still not working .
I am Expecting that when i login or signUp my code should redirect to :
http://localhost:3000/dashboard/userfirstname/userlastname .
Upvotes: 0
Views: 58