mirror of
https://github.com/MoonTechLab/LunaTV.git
synced 2026-02-22 02:24:44 +08:00
fix: logout problem
This commit is contained in:
@@ -40,10 +40,6 @@
|
||||
"api": "https://wolongzyw.com/api.php/provide/vod",
|
||||
"name": "卧龙资源"
|
||||
},
|
||||
"hwba": {
|
||||
"api": "https://cjhwba.com/api.php/provide/vod",
|
||||
"name": "华为吧资源"
|
||||
},
|
||||
"jisu": {
|
||||
"api": "https://jszyapi.com/api.php/provide/vod",
|
||||
"name": "极速资源",
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
'use client';
|
||||
|
||||
import { LogOut } from 'lucide-react';
|
||||
import { useRouter } from 'next/navigation';
|
||||
|
||||
/**
|
||||
* 退出登录按钮
|
||||
@@ -13,15 +12,13 @@ import { useRouter } from 'next/navigation';
|
||||
* 2. 跳转到 /login 页面
|
||||
*/
|
||||
export function LogoutButton() {
|
||||
const router = useRouter();
|
||||
|
||||
const handleLogout = () => {
|
||||
if (typeof window !== 'undefined') {
|
||||
localStorage.removeItem('username');
|
||||
localStorage.removeItem('password');
|
||||
}
|
||||
// 使用 replace,避免用户返回上一页时仍然处于已登录状态
|
||||
router.replace('/login');
|
||||
window.location.reload();
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user