Display admin actions

This commit is contained in:
2021-07-11 15:07:57 +02:00
parent 54c9b84945
commit 0cd6de200d
6 changed files with 229 additions and 2 deletions

View File

@ -17,7 +17,7 @@ export interface AdminAccount {
name: string;
email: string;
time_create: number;
roles: Array<"manage_admins" | "manage_users" | "access_full_admin_logs">;
roles: Array<"manage_admins" | "manage_users" | "access_all_admin_logs">;
}
export interface NewAdminGeneralSettings {

View File

@ -0,0 +1,30 @@
import { serverRequest } from "./APIHelper";
export interface AdminLogMessage {
id: number;
admin_id: number;
ip: string;
time: number;
action: string;
args: any;
format: string;
}
export class AdminLogsHelper {
/**
* Get the list of admin log actions from the server
*/
static async GetLogs(): Promise<AdminLogMessage[]> {
return (await serverRequest("logs/list")).map((el: any) => {
if (typeof el.action === "string") return el;
for (let key in el.action) {
if (!el.action.hasOwnProperty(key)) continue;
el.args = el.action[key];
el.action = key;
}
return el;
});
}
}