mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-08 00:26:37 +08:00
prettier
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"use client"
|
||||
'use client';
|
||||
|
||||
import { useUser } from "@/contexts/user-context"
|
||||
import { useUser } from '@/contexts/user-context';
|
||||
|
||||
/**
|
||||
* Auth provider bridge hook
|
||||
@@ -9,5 +9,5 @@ import { useUser } from "@/contexts/user-context"
|
||||
* Delegates to the canonical UserContext under the hood.
|
||||
*/
|
||||
export function useAuth() {
|
||||
return useUser()
|
||||
return useUser();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client"
|
||||
'use client';
|
||||
|
||||
import {QueryClient, QueryClientProvider} from "@tanstack/react-query"
|
||||
import {useState} from "react"
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
import { useState } from 'react';
|
||||
|
||||
export function AppQueryProvider({ children }: { children: React.ReactNode }) {
|
||||
const [queryClient] = useState(
|
||||
@@ -15,9 +15,9 @@ export function AppQueryProvider({ children }: { children: React.ReactNode }) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
)
|
||||
);
|
||||
|
||||
return (
|
||||
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,36 +1,36 @@
|
||||
"use client"
|
||||
'use client';
|
||||
|
||||
import {useQuery} from '@tanstack/react-query'
|
||||
import {useEffect} from 'react'
|
||||
import {ConfigService} from '@/lib/services/config'
|
||||
import {usePathname} from 'next/navigation'
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { useEffect } from 'react';
|
||||
import { ConfigService } from '@/lib/services/config';
|
||||
import { usePathname } from 'next/navigation';
|
||||
|
||||
export function SiteTitleUpdater() {
|
||||
const pathname = usePathname()
|
||||
const pathname = usePathname();
|
||||
const publicConfigQuery = useQuery({
|
||||
queryKey: ["public-config"],
|
||||
queryKey: ['public-config'],
|
||||
queryFn: () => ConfigService.getPublicConfig(),
|
||||
})
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
const siteName = publicConfigQuery.data?.site_name || "Wavelet Platform"
|
||||
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 = ""
|
||||
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])
|
||||
document.title = `${siteName}${suffix}`;
|
||||
}, [publicConfigQuery.data?.site_name, pathname]);
|
||||
|
||||
return null
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user