feat/0.2:add theme setting and about page setting and support use email and password login
This commit is contained in:
1 parent
58292b0e6e
commit
ca2b732952
85 files changed
+5797
-816
No files matched your search
@@ -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;
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user