Spaces:
Running
Running
Download processor/web/workflow-studio/src/api/auth.ts from Stouching-Robotics/DataFlowing: direct link, hf CLI and curl.
- Browser
- Download file 474 Bytes
-
https://huggingface.co/spaces/Stouching-Robotics/DataFlowing/resolve/main/processor/web/workflow-studio/src/api/auth.ts
- Command line
-
hf download hf://spaces/Stouching-Robotics/DataFlowing/processor/web/workflow-studio/src/api/auth.ts
-
curl -L -o auth.ts https://huggingface.co/spaces/Stouching-Robotics/DataFlowing/resolve/main/processor/web/workflow-studio/src/api/auth.ts
474 Bytes
| /** Auth API — bootstrap from the shared layout, with API fallback. */ | |
| import { req } from './workflows'; | |
| export interface CurrentUser { | |
| id: string; | |
| username: string; | |
| role: string; | |
| } | |
| declare global { | |
| interface Window { | |
| __EGO_USER__?: CurrentUser; | |
| } | |
| } | |
| export function getCurrentUser(): Promise<CurrentUser> { | |
| const bootstrap = window.__EGO_USER__; | |
| if (bootstrap?.role) return Promise.resolve(bootstrap); | |
| return req<CurrentUser>('/api/v1/auth/me'); | |
| } | |