new funcionality

This commit is contained in:
2026-07-27 17:20:02 +02:00
parent c2b5291a74
commit c5ce8a7a36
101 changed files with 6889 additions and 176 deletions

View File

@@ -48,8 +48,21 @@ export const useAuthStore = defineStore('auth', {
}
},
async login(payload: Credentials): Promise<string | null> {
const { data } = await axios.post<{ user: User; intended: string | null }>('/web-api/login', payload);
async login(payload: Credentials): Promise<{ twoFactor: true } | { twoFactor: false; intended: string | null }> {
const { data } = await axios.post<{ two_factor?: true; user?: User; intended?: string | null }>('/web-api/login', payload);
if (data.two_factor) {
return { twoFactor: true };
}
this.user = data.user!;
this.checked = true;
return { twoFactor: false, intended: data.intended ?? null };
},
async loginTwoFactor(code: string): Promise<string | null> {
const { data } = await axios.post<{ user: User; intended: string | null }>('/web-api/login/2fa', { code });
this.user = data.user;
this.checked = true;