| import { API_BASE_URL, getHeaders, handleResponse } from './util'; | |
| export interface Account { | |
| id: number, | |
| owner: string, | |
| repo: string, | |
| ref: string, | |
| type: "github" | "hf", | |
| token: string, | |
| } | |
| export const accountApi = { | |
| async post(accounts: Account[]) { | |
| const response = await fetch( | |
| `${API_BASE_URL}/api/account`, | |
| { | |
| headers: getHeaders(), | |
| method: 'POST', | |
| body: JSON.stringify(accounts) | |
| } | |
| ); | |
| return handleResponse(response); | |
| }, | |
| async get(): Promise<Account[]> { | |
| const response = await fetch( | |
| `${API_BASE_URL}/api/account`, | |
| { | |
| headers: getHeaders() | |
| } | |
| ); | |
| return handleResponse(response); | |
| }, | |
| } | |