diff --git a/frontend/src/api/admin.ts b/frontend/src/api/admin.ts new file mode 100644 index 0000000..d3fdfc1 --- /dev/null +++ b/frontend/src/api/admin.ts @@ -0,0 +1,55 @@ +import { Requests, Responses, UserRole } from 'dto'; +import { get_token, post_token } from './base'; + +export const get_users = (token: string): Promise => + get_token('/api/admin/users', token); + +export const set_role = ( + user: number, + role: UserRole, + token: string +): Promise => + post_token( + '/api/admin/set_role', + { + user, + role + }, + token + ); + +export const logout = ( + user: number, + token: string +): Promise => + post_token( + '/api/admin/logout', + { + user + }, + token + ); + +export const delete_user = ( + user: number, + token: string +): Promise => + post_token( + '/api/admin/delete', + { + user + }, + token + ); + +export const disable_tfa = ( + user: number, + token: string +): Promise => + post_token( + '/api/admin/disable_2fa', + { + user + }, + token + ); diff --git a/frontend/src/api/index.ts b/frontend/src/api/index.ts index 29c0f1d..ab67b3e 100644 --- a/frontend/src/api/index.ts +++ b/frontend/src/api/index.ts @@ -4,4 +4,5 @@ export { isErrorResponse } from './base'; export * as Auth from './auth'; export * as FS from './fs'; export * as User from './user'; +export * as Admin from './admin'; export * from './util';