mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-04 23:16:37 +08:00
登录界面优化
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
"use client"
|
||||
|
||||
import {useQuery} from '@tanstack/react-query'
|
||||
import {useEffect} from 'react'
|
||||
import services from '@/lib/services'
|
||||
import {usePathname} from 'next/navigation'
|
||||
|
||||
export function SiteTitleUpdater() {
|
||||
const pathname = usePathname()
|
||||
const publicConfigQuery = useQuery({
|
||||
queryKey: ["public-config"],
|
||||
queryFn: () => services.config.getPublicConfig(),
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
const siteName = publicConfigQuery.data?.site_name || "Wavelet Platform"
|
||||
|
||||
// Determine the page suffix based on path
|
||||
let suffix = ""
|
||||
if (pathname === "/login") {
|
||||
suffix = " - 登录"
|
||||
} else if (pathname === "/register") {
|
||||
suffix = " - 注册"
|
||||
} else if (pathname.startsWith("/admin")) {
|
||||
suffix = " - 后台管理"
|
||||
} else if (pathname === "/home") {
|
||||
suffix = " - 控制台"
|
||||
} else if (pathname === "/") {
|
||||
suffix = ""
|
||||
}
|
||||
|
||||
document.title = `${siteName}${suffix}`
|
||||
}, [publicConfigQuery.data?.site_name, pathname])
|
||||
|
||||
return null
|
||||
}
|
||||
Reference in New Issue
Block a user