API: auth: preload server configs along with /verify response

Get rid of last build-time config dependency and allows easier
switching of client modes.
This commit is contained in:
Jesse Chan
2020-10-26 20:17:20 +08:00
parent 306ff79182
commit 6c41c764f1
6 changed files with 66 additions and 18 deletions
+11 -3
View File
@@ -23,8 +23,14 @@ export type AuthRegistrationOptions = Required<z.infer<typeof authRegistrationSc
export const authUpdateUserSchema = credentialsSchema.partial();
export type AuthUpdateUserOptions = z.infer<typeof authUpdateUserSchema>;
// GET /api/auth/verify - preload configurations
export interface AuthVerificationPreloadConfigs {
disableAuth: boolean;
pollInterval: number;
}
// GET /api/auth/verify - success response
export type AuthVerificationResponse =
export type AuthVerificationResponse = (
| {
initialUser: true;
}
@@ -32,5 +38,7 @@ export type AuthVerificationResponse =
initialUser: false;
username: string;
level: AccessLevel;
token?: string;
};
}
) & {
configs: AuthVerificationPreloadConfigs;
};