mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-28 12:57:31 -07:00
[backend/web-api] Make auth status response less confusing
This commit is contained in:
parent
1870dc33b5
commit
8134e92284
2 changed files with 2 additions and 4 deletions
|
@ -21,8 +21,7 @@ export class AuthController {
|
||||||
): Promise<AuthResponse> {
|
): Promise<AuthResponse> {
|
||||||
const user = me ? await UserHandler.getUser(me, me.id) : null;
|
const user = me ? await UserHandler.getUser(me, me.id) : null;
|
||||||
return {
|
return {
|
||||||
authenticated: !!session?.active,
|
status: !user ? 'guest' : session?.active ? 'authenticated' : '2fa',
|
||||||
status: user && session?.active ? null : '2fa',
|
|
||||||
token: session?.token ?? null,
|
token: session?.token ?? null,
|
||||||
user: user,
|
user: user,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import { UserResponse } from "@/server/api/web/entities/user.js";
|
import { UserResponse } from "@/server/api/web/entities/user.js";
|
||||||
|
|
||||||
export type AuthResponse = {
|
export type AuthResponse = {
|
||||||
authenticated: boolean;
|
status: 'guest' | 'authenticated' | '2fa';
|
||||||
status: null | '2fa';
|
|
||||||
token: string | null;
|
token: string | null;
|
||||||
user: UserResponse | null;
|
user: UserResponse | null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue