feat(api,frontend): add qr code login

This commit is contained in:
hh committed 2026-08-06 00:23:38 +02:00
1 parent 9c265af3d3
commit e887dfc5ce
9 files changed
+315 -80

No files matched your search

+8
View File
@@ -53,6 +53,14 @@ export function startLogin(phone: string): Promise<LoginState> {
});
}
export function startQrLogin(): Promise<LoginState> {
return request<LoginState>("/accounts/login/qr", { method: "POST" });
}
export function pollQrLogin(loginId: string): Promise<LoginState> {
return request<LoginState>(`/accounts/login/${loginId}/qr`);
}
export function submitLoginCode(
loginId: string,
code: string
+2 -1
View File
@@ -22,11 +22,12 @@ export interface Account {
tg_user_id: number | null;
}
export type LoginStage = "code" | "password" | "done";
export type LoginStage = "code" | "qr" | "password" | "done";
export interface LoginState {
account: Account | null;
login_id: string;
qr_url: string | null;
stage: LoginStage;
}