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