feat: minimal UI for login

This commit is contained in:
2025-04-11 11:08:33 +01:00
parent c9a6c83649
commit 2302ba5eeb
5 changed files with 86 additions and 0 deletions

View File

@@ -113,3 +113,33 @@ export const getUserImages = async (): Promise<UserImage[]> => {
return parse(getUserImagesResponseValidator, res);
};
export const postLogin = async (email: string): Promise<void> => {
const request = getBaseRequest({
path: "login",
body: JSON.stringify({ email }),
method: "POST",
});
await fetch(request);
};
const codeValidator = strictObject({
access: string(),
refresh: string(),
});
export const postCode = async (
email: string,
code: string,
): Promise<InferOutput<typeof codeValidator>> => {
const request = getBaseRequest({
path: "code",
body: JSON.stringify({ email, code }),
method: "POST",
});
const res = await fetch(request).then((res) => res.json());
return parse(codeValidator, res);
};