Initial frontend import
This commit is contained in:
13
src/admin/token.ts
Normal file
13
src/admin/token.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
const KEY = "ark_admin_token";
|
||||
|
||||
export function getToken() {
|
||||
return localStorage.getItem(KEY) || "";
|
||||
}
|
||||
|
||||
export function setToken(t: string) {
|
||||
localStorage.setItem(KEY, t);
|
||||
}
|
||||
|
||||
export function clearToken() {
|
||||
localStorage.removeItem(KEY);
|
||||
}
|
||||
7
src/admin/useAdminT.ts
Normal file
7
src/admin/useAdminT.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { useCallback } from "react";
|
||||
import { tLang } from "../i18n";
|
||||
|
||||
/** Admin area always uses 繁體中文, independent of site language. */
|
||||
export function useAdminT() {
|
||||
return useCallback((key: string) => tLang("zh-TW", key), []);
|
||||
}
|
||||
Reference in New Issue
Block a user