This commit is contained in:
hailin 2025-03-15 20:48:59 +08:00
parent 6c2cd58d65
commit 561f1d57e0
3 changed files with 16 additions and 35 deletions

View File

@ -68,16 +68,8 @@ export function MixSignIn(props: {
}
localStorage.setItem("UserData", JSON.stringify(result.data));
// []方法
{ {/* localStorage["name"]="bonly"; */ } }
console.log("--result.data:", result.data)
setTimeout(() => {
window.location.href = `/`;
}, 10000); // 延迟 10 秒跳转
//window.location.href = `/`
window.location.href = `/`
}).catch((err) => {
setIsLoading(false);
console.log(err);

View File

@ -69,15 +69,8 @@ export function Header() {
<div className="flex items-center justify-between ">
<div className="flex items-center ">
{/* <IconSeparator className="size-6 text-muted-foreground/50" /> */}
{(!!userData && !!userData.user_name) ? (
<div className='flex text-[#1A1A1A]'>
{/* <Button variant="ghost" className='text-base bg-[#f4f4f5] hover:bg-[#e5e7eb]'
onClick={() => {
router.push("/subscribe")
}}
> {t("subscribe.subscribe")}</Button> */}
<UserMenu user={userData} />
</div>

View File

@ -65,13 +65,25 @@ export function UserMenu({ user }: { user: UserData }) {
<div className="text-xs font-medium">{user?.user_name}</div>
<div className="text-xs text-zinc-500">{user?.user_name}</div>
</DropdownMenuItem> */}
{/* 新增 "Profile" 选项 */}
<DropdownMenuItem
onClick={() => {
router.push('/profile'); // 假设用户的个人资料页面是 "/profile"
}}
className="text-xs"
>
Profile
</DropdownMenuItem>
{/* 分隔线(可选) */}
<div className="border-t border-gray-200 my-1"></div>
{/* "Log Out" 选项 */}
<DropdownMenuItem
onClick={async () => {
console.log('logout')
if (isLoading) return
setIsLoading(true);
await service.post('/api/v1/customer/logout', {
}, {
@ -90,30 +102,14 @@ export function UserMenu({ user }: { user: UserData }) {
localStorage.removeItem("UserData");
// router.refresh()
// router.push('/')
window.location.href = `/`
// location.reload();
}).catch((err) => {
setIsLoading(false);
localStorage.removeItem("UserData");
// location.reload();
window.location.href = `/`
console.log(err);
// if (err.errors[0].code === "form_identifier_not_found") {
// props.setAccountNotFound(true);
// props.email(email);
// } else {
// props.setError("Sorry, We couldn't sign you in. Please try again later");
// }
});
// signOut({
// callbackUrl: '/'
// })
}
}