diff --git a/public/index.html b/public/index.html index a446633..5995005 100644 --- a/public/index.html +++ b/public/index.html @@ -1,21 +1,21 @@ - - - - - - - - - - - Comunic Console - - - -
- - + --> diff --git a/src/helpers/AdminKeyHelper.ts b/src/helpers/AdminKeyHelper.ts index 36e00f9..aba744a 100644 --- a/src/helpers/AdminKeyHelper.ts +++ b/src/helpers/AdminKeyHelper.ts @@ -133,7 +133,7 @@ export class AdminKeyHelper { * @param adminID The id of the target administrator */ static async GetAdminKeys(adminID: number): Promise { - return await serverRequest("keys/keys", { + return await serverRequest("keys/list", { id: adminID, }); } diff --git a/src/helpers/AdminRolesHelper.ts b/src/helpers/AdminRolesHelper.ts new file mode 100644 index 0000000..af9810f --- /dev/null +++ b/src/helpers/AdminRolesHelper.ts @@ -0,0 +1,26 @@ +/** + * Admin roles helper + * + * @author Pierre Hubert + */ + +import { serverRequest } from "./APIHelper"; + +export interface AdminRole { + id: string; + name: string; + description: string; +} + +let RolesList: AdminRole[] = []; + +export class AdminRolesHelper { + /** + * Load the list of roles. + * + * @throws In case of failure + */ + static async LoadRolesList() { + RolesList = await serverRequest("roles/list"); + } +} diff --git a/src/ui/widgets/InitWidget.tsx b/src/ui/widgets/InitWidget.tsx index 7d53c0c..a5dac7f 100644 --- a/src/ui/widgets/InitWidget.tsx +++ b/src/ui/widgets/InitWidget.tsx @@ -6,6 +6,7 @@ import React from "react"; import { AccountHelper } from "../../helpers/AccountHelper"; +import { AdminRolesHelper } from "../../helpers/AdminRolesHelper"; import { LoginRoute } from "../routes/LoginRoute"; import { MainRoute } from "../routes/MainRoute"; import { AsyncWidget } from "./AsyncWidget"; @@ -31,6 +32,9 @@ export class InitWidget extends React.Component<{}, InitWidgetState> { if (AccountHelper.hasAccessToken) { await AccountHelper.refreshCurrentAccountInfo(); + + await AdminRolesHelper.LoadRolesList(); + this.setState({ signedIn: true }); } }