hezarfen_frontend
Clone
https://git.tahinli.com/Hezarfen/hezarfen_frontend.git
0 watching0 forksTypeScript5.5 MiB5fcd955Burak Boduroğlu2 months ago730 commits
| 1 | import { client } from "../client"; |
| 2 | import type { User } from "../client"; |
| 3 | |
| 4 | export 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. */ |
| 10 | export type SchoolChoice = { |
| 11 | id: string; |
| 12 | name: string; |
| 13 | }; |
| 14 | |
| 15 | export type SchoolChoiceResponse = { |
| 16 | username: string; |
| 17 | schools: SchoolChoice[]; |
| 18 | }; |
| 19 | |
| 20 | export type LoginResponse = User | SchoolChoiceResponse; |
| 21 | |
| 22 | export function postLogin(body: LoginBody): Promise<LoginResponse> { |
| 23 | return client<LoginResponse>("/auth/login", { method: "POST", body }); |
| 24 | } |