MCPcopy Create free account
hub / github.com/PIKACHUIM/CFWorkerACME / checkAuth

Function checkAuth

frontend/src/api/auth.ts:114–134  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

112 * 检查登录状态
113 */
114export async function checkAuth(): Promise<{
115 loggedIn: boolean;
116 email?: string;
117 isAdmin?: boolean;
118 quota?: number;
119}> {
120 try {
121 const data = await apiGet<ApiResp>('/check/');
122 if (data.flags === 0) {
123 return {
124 loggedIn: true,
125 email: data.texts,
126 isAdmin: Number((data as any).is_admin ?? 0) === 1,
127 quota: typeof (data as any).quota === 'number' ? (data as any).quota : -1,
128 };
129 }
130 return { loggedIn: false };
131 } catch {
132 return { loggedIn: false };
133 }
134}
135
136/**
137 * 退出登录

Callers 2

AppRoutesFunction · 0.85
handleLoginFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected