forge
Explore
Log in

Don't you dare go Hollow

hezarfen_frontend

Clone
★ 0

0 watching0 forksTypeScript5.5 MiB5fcd955Burak Boduroğlu2 months ago730 commits

postLogin.ts24 lines, 596 bytesHistoryRawDownload
1import { client } from "../client";
2import type { User } from "../client";
3
4export type LoginBody = {
5 username: string;
6 password: string;
7};
8
9/** One school on offer: its registry uuid (what `POST /auth/school` takes) and display name. */
10export type SchoolChoice = {
11 id: string;
12 name: string;
13};
14
15export type SchoolChoiceResponse = {
16 username: string;
17 schools: SchoolChoice[];
18};
19
20export type LoginResponse = User | SchoolChoiceResponse;
21
22export function postLogin(body: LoginBody): Promise<LoginResponse> {
23 return client<LoginResponse>("/auth/login", { method: "POST", body });
24}