应用 eslint 规则
This commit is contained in:
@@ -16,7 +16,7 @@ const tabs = [
|
||||
{ id: 'city', label: '城市信息' },
|
||||
{ id: 'allocation', label: '分配状态' },
|
||||
{ id: 'edge', label: '节点信息' },
|
||||
{ id: 'setting', label: '设置'}
|
||||
{ id: 'setting', label: '设置' },
|
||||
]
|
||||
|
||||
function DashboardContent() {
|
||||
@@ -24,7 +24,7 @@ function DashboardContent() {
|
||||
const [isLoading, setIsLoading] = useState(false)
|
||||
const router = useRouter()
|
||||
const searchParams = useSearchParams()
|
||||
|
||||
|
||||
// 监听URL参数变化
|
||||
useEffect(() => {
|
||||
const urlTab = searchParams.get('tab')
|
||||
@@ -40,17 +40,20 @@ function DashboardContent() {
|
||||
const response = await fetch('/api/auth/logout', {
|
||||
method: 'POST',
|
||||
})
|
||||
|
||||
|
||||
if (response.ok) {
|
||||
// 退出成功后跳转到登录页
|
||||
router.push('/login')
|
||||
router.refresh()
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
console.error('退出失败')
|
||||
}
|
||||
} catch (error) {
|
||||
}
|
||||
catch (error) {
|
||||
console.error('退出错误:', error)
|
||||
} finally {
|
||||
}
|
||||
finally {
|
||||
setIsLoading(false)
|
||||
}
|
||||
}
|
||||
@@ -71,7 +74,7 @@ function DashboardContent() {
|
||||
<div className="flex items-center">
|
||||
<h1 className="text-xl font-bold text-gray-900">网络节点管理系统</h1>
|
||||
</div>
|
||||
|
||||
|
||||
{/* 简化的退出按钮 */}
|
||||
<button
|
||||
onClick={handleLogout}
|
||||
@@ -88,7 +91,7 @@ function DashboardContent() {
|
||||
<div className="flex flex-3 overflow-hidden px-4 sm:px-6 lg:px-8 py-8">
|
||||
<div className="border-b border-gray-200 mb-6">
|
||||
<nav className="flex flex-col w-64 -mb-px space-x-8">
|
||||
{tabs.map((tab) => (
|
||||
{tabs.map(tab => (
|
||||
<button
|
||||
key={tab.id}
|
||||
onClick={() => handleTabClick(tab.id)}
|
||||
@@ -110,7 +113,7 @@ function DashboardContent() {
|
||||
{activeTab === 'city' && <CityNodeStats />}
|
||||
{activeTab === 'allocation' && <AllocationStatus detailed />}
|
||||
{activeTab === 'edge' && <Edge />}
|
||||
{activeTab === 'setting' && <Settings/>}
|
||||
{activeTab === 'setting' && <Settings />}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -119,15 +122,15 @@ function DashboardContent() {
|
||||
|
||||
export default function Dashboard() {
|
||||
return (
|
||||
<Suspense fallback={
|
||||
<Suspense fallback={(
|
||||
<div className=" bg-gray-100 flex items-center justify-center">
|
||||
<div className="text-center">
|
||||
<div className="animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"></div>
|
||||
<p className="mt-4 text-gray-600">加载中...</p>
|
||||
</div>
|
||||
</div>
|
||||
}>
|
||||
)}>
|
||||
<DashboardContent />
|
||||
</Suspense>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user