git-proxy / src /services /userApi.ts
github-actions[bot]
Update from GitHub Actions
15ff6c7
raw
history blame
567 Bytes
import { API_BASE_URL, handleResponse } from './util';
export interface LoginResponse {
success: boolean;
token: string;
message?: string;
}
export const userApi = {
async login(username: string, password: string): Promise<LoginResponse> {
const response = await fetch(`${API_BASE_URL}/api/login`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ username, password }),
});
return handleResponse(response);
}
};