mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-13 00:10:27 +00:00
feat: 新版webui
This commit is contained in:
15
napcat.webui/src/hooks/auth.ts
Normal file
15
napcat.webui/src/hooks/auth.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { useLocalStorage } from '@uidotdev/usehooks'
|
||||
|
||||
import key from '@/const/key'
|
||||
|
||||
const useAuth = () => {
|
||||
const [token, setToken] = useLocalStorage<string>(key.token, '')
|
||||
|
||||
return {
|
||||
token,
|
||||
isAuth: !!token,
|
||||
revokeAuth: () => setToken('')
|
||||
}
|
||||
}
|
||||
|
||||
export default useAuth
|
||||
Reference in New Issue
Block a user