mirror of
https://gitlab.com/comunic/comunicconsole
synced 2025-06-20 00:25:19 +00:00
Display admin actions
This commit is contained in:
@ -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 {
|
||||
|
30
src/helpers/AdminLogsHelper.ts
Normal file
30
src/helpers/AdminLogsHelper.ts
Normal 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;
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user