我尝试在我的项目中使用 afterSignInUrl="/learn" 属性,但它不起作用,软件包已安装,我已经搜索了文档,什么也没找到......我知道它存在,但我'我无法使用它。如果有人可以提供帮助,我很感激。
import Image from "next/image";
import { Loader } from "lucide-react";
import {
ClerkLoaded,
ClerkLoading,
SignedIn,
SignedOut,
SignInButton,
UserButton,
} from "@clerk/nextjs";
import { Button } from "@/components/ui/button";
export const Header = () => {
return (
<header className="h-20 w-full border-b-2
border-slate-200 px-4">
<div className="lg:max-w-screen-lg mx-auto flex items-center
justify-between h-full">
<div className="pt-8 pl-4 pb-7 flex items-center gap-x-3">
<Image src="/mascot.svg" height={40} width={40} alt="Mascot" />
<h1 className="text-2xl font-extrabold text-green-600 tracking-wide">
Lingo
</h1>
</div>
<ClerkLoading>
<Loader className="h-5 w-5 text-muted-foreground animate-spin" />
</ClerkLoading>
<ClerkLoaded>
<SignedIn>
<UserButton
afterSignOutUrl="/"
/>
</SignedIn>
<SignedOut>
<SignInButton mode="modal"
afterSignInUrl="/learn"
afterSignUpUrl="/learn"
>
<Button size="lg" variant="ghost">
Login
</Button>
</SignInButton>
</SignedOut>
</ClerkLoaded>
</div>
</header>
);
};
我试图在登录后将用户重定向到 /learn 页面,但这并没有发生。我的身份验证和其他一切都正确,但我被重定向回主页。
你得到答案了吗?我按照教程