update frontend to match new user-info endpoint
All checks were successful
Build Container / Build Container (push) Successful in 1m27s
All checks were successful
Build Container / Build Container (push) Successful in 1m27s
This commit is contained in:
parent
99668e2a33
commit
2e1742279d
3 changed files with 22 additions and 28 deletions
|
|
@ -1,3 +1,3 @@
|
|||
# Update schema
|
||||
|
||||
`pnpm dlx openapi-typescript http://localhost:8000/openapi.json -o ./schema.ts`
|
||||
`pnpm dlx openapi-typescript http://localhost:8000/api/openapi.json -o ./schema.ts`
|
||||
|
|
|
|||
|
|
@ -127,6 +127,21 @@ export interface paths {
|
|||
export type webhooks = Record<string, never>;
|
||||
export interface components {
|
||||
schemas: {
|
||||
/** ApiUser */
|
||||
ApiUser: {
|
||||
/** Is Anonymous */
|
||||
is_anonymous: boolean;
|
||||
/** Is Ccchh User */
|
||||
is_ccchh_user: boolean;
|
||||
/** Is Token User */
|
||||
is_token_user: boolean;
|
||||
/** May Operate Locks */
|
||||
may_operate_locks: boolean;
|
||||
/** Username */
|
||||
username: string;
|
||||
/** Guaranteed Session Until */
|
||||
guaranteed_session_until: string | null;
|
||||
};
|
||||
/** HTTPValidationError */
|
||||
HTTPValidationError: {
|
||||
/** Detail */
|
||||
|
|
@ -193,20 +208,6 @@ export interface components {
|
|||
*/
|
||||
activity_state: "unknown" | "locking" | "unlocking" | "stable";
|
||||
};
|
||||
/** UserStatus */
|
||||
UserStatus: {
|
||||
/** Is Authorized */
|
||||
is_authorized: boolean;
|
||||
/**
|
||||
* Guaranteed Session Until
|
||||
* Format: date-time
|
||||
*/
|
||||
guaranteed_session_until: string;
|
||||
/** Username */
|
||||
username: string;
|
||||
/** Ccchh Roles */
|
||||
ccchh_roles: string[];
|
||||
};
|
||||
/** ValidationError */
|
||||
ValidationError: {
|
||||
/** Location */
|
||||
|
|
@ -244,16 +245,7 @@ export interface operations {
|
|||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["UserStatus"];
|
||||
};
|
||||
};
|
||||
/** @description Unauthorized */
|
||||
401: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["HttpProblemDetail"];
|
||||
"application/json": components["schemas"]["ApiUser"];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -93,13 +93,15 @@ async function checkUser() {
|
|||
const {data: userInfo} = await getUserInfo({})
|
||||
|
||||
apiError.current = null
|
||||
auth.authenticated = true
|
||||
auth.authorized = userInfo.is_authorized
|
||||
auth.authenticated = !userInfo.is_anonymous
|
||||
auth.authorized = userInfo.may_operate_locks
|
||||
auth.until = userInfo.guaranteed_session_until ? new Date(userInfo.guaranteed_session_until) : null
|
||||
auth.username = userInfo.username ?? ""
|
||||
auth.recentLogout = false
|
||||
|
||||
triggerAuthTimeout()
|
||||
if (auth.authenticated) {
|
||||
triggerAuthTimeout()
|
||||
}
|
||||
} catch (e) {
|
||||
// check which operation threw the exception
|
||||
if (e instanceof getUserInfo.Error) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue