mirror of
https://github.com/Dvorinka/MyClubServer.git
synced 2026-06-04 18:52:56 +00:00
dev day #89
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
import api from './api';
|
||||
|
||||
export interface ErrorEvent {
|
||||
id: number;
|
||||
origin: string;
|
||||
language?: string;
|
||||
severity?: string;
|
||||
message: string;
|
||||
stack?: string;
|
||||
component?: string;
|
||||
file?: string;
|
||||
line?: number;
|
||||
column?: number;
|
||||
url?: string;
|
||||
method?: string;
|
||||
status?: number;
|
||||
request_id?: string;
|
||||
user_id?: number;
|
||||
session_token?: string;
|
||||
tags?: Record<string, any> | null;
|
||||
context?: Record<string, any> | null;
|
||||
env?: string;
|
||||
version?: string;
|
||||
hostname?: string;
|
||||
occurred_at: string;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export interface ErrorListResponse {
|
||||
items: ErrorEvent[];
|
||||
total: number;
|
||||
}
|
||||
|
||||
export async function getErrors(params?: {
|
||||
origin?: string;
|
||||
severity?: string;
|
||||
method?: string;
|
||||
status?: string | number;
|
||||
search?: string;
|
||||
from?: string; // ISO
|
||||
to?: string; // ISO
|
||||
page?: number;
|
||||
limit?: number;
|
||||
}): Promise<ErrorListResponse> {
|
||||
const res = await api.get('/admin/errors', { params });
|
||||
return res.data as ErrorListResponse;
|
||||
}
|
||||
|
||||
export async function getError(id: number): Promise<ErrorEvent> {
|
||||
const res = await api.get(`/admin/errors/${id}`);
|
||||
return res.data as ErrorEvent;
|
||||
}
|
||||
|
||||
export async function getExternalErrors(params?: {
|
||||
origin?: string;
|
||||
severity?: string;
|
||||
method?: string;
|
||||
status?: string | number;
|
||||
search?: string;
|
||||
from?: string; // ISO
|
||||
to?: string; // ISO
|
||||
page?: number;
|
||||
limit?: number;
|
||||
}): Promise<ErrorListResponse> {
|
||||
const res = await api.get('/admin/errors/external', { params });
|
||||
return res.data as ErrorListResponse;
|
||||
}
|
||||
|
||||
export async function getExternalError(id: number): Promise<ErrorEvent> {
|
||||
const res = await api.get(`/admin/errors/external/${id}`);
|
||||
return res.data as ErrorEvent;
|
||||
}
|
||||
Reference in New Issue
Block a user