Spaces:
Runtime error
Runtime error
Download frontend/src/api/auth.ts from SII-gelingli/echem-agent: direct link, hf CLI and curl.
- Browser
- Download file 796 Bytes
-
https://huggingface.co/spaces/SII-gelingli/echem-agent/resolve/main/frontend/src/api/auth.ts
- Command line
-
hf download hf://spaces/SII-gelingli/echem-agent/frontend/src/api/auth.ts
-
curl -L -o auth.ts https://huggingface.co/spaces/SII-gelingli/echem-agent/resolve/main/frontend/src/api/auth.ts
796 Bytes
| import apiClient from './client'; | |
| import type { LoginRequest, RegisterRequest, TokenResponse, UserInfo } from '../utils/types'; | |
| export async function login(data: LoginRequest): Promise<TokenResponse> { | |
| const res = await apiClient.post<TokenResponse>('/auth/login', data); | |
| return res.data; | |
| } | |
| export async function register(data: RegisterRequest): Promise<TokenResponse> { | |
| const res = await apiClient.post<TokenResponse>('/auth/register', data); | |
| return res.data; | |
| } | |
| export async function refreshToken(refresh_token: string): Promise<TokenResponse> { | |
| const res = await apiClient.post<TokenResponse>('/auth/refresh', { refresh_token }); | |
| return res.data; | |
| } | |
| export async function getMe(): Promise<UserInfo> { | |
| const res = await apiClient.get<UserInfo>('/auth/me'); | |
| return res.data; | |
| } | |