git-proxy / src /services /accountApi.ts
github-actions[bot]
Update from GitHub Actions
15ff6c7
raw
history blame contribute delete
814 Bytes
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);
},
}