feat/0.2:add theme setting and about page setting and support use email and password login

This commit is contained in:
lethe committed 2025-07-24 10:28:42 +08:00
1 parent 58292b0e6e
commit ca2b732952
85 files changed
+5797 -816

No files matched your search

+9
View File
@@ -27,6 +27,7 @@ export type AdminStore = {
// Admin operations
adminLogOut: () => void;
adminLogin: (username: string, password: string) => Promise<ApiResponse>;
getAdminUser: () => Promise<ApiResponse>;
};
const fn: StateCreator<AdminStore, []> = (set, get) => {
@@ -115,6 +116,14 @@ const fn: StateCreator<AdminStore, []> = (set, get) => {
};
}
},
getAdminUser: async () => {
const { setAdmin } = get();
const res = await fetchAdminAPI("/api/user/info");
if (res.success) {
setAdmin(res.data);
}
return res;
},
};
};