46 lines
1.2 KiB
TypeScript
46 lines
1.2 KiB
TypeScript
import { client } from "@/shared/api";
|
|
import { ENDPOINT } from "@/shared/config";
|
|
import {
|
|
type ConnectionLogParams,
|
|
type ConnectionStatisticsParams,
|
|
type ConnectionStatistics,
|
|
type ConnectionLogService,
|
|
type ConnectionLogPageList,
|
|
type ConnectionLogPayload,
|
|
type ConnectionLog,
|
|
} from "../model/connection-log-interface";
|
|
|
|
class ConnectionLogApiService implements ConnectionLogService {
|
|
async getConnectionLogPage(
|
|
params: ConnectionLogParams,
|
|
): Promise<ConnectionLogPageList> {
|
|
const response = await client.get<ConnectionLogPageList>(
|
|
`${ENDPOINT.CMS_SERVICE.CONNECTION_LOG}`,
|
|
{ params },
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
async getConnectionStatistics(
|
|
params: ConnectionStatisticsParams,
|
|
): Promise<ConnectionStatistics> {
|
|
const response = await client.get<ConnectionStatistics>(
|
|
`${ENDPOINT.CMS_SERVICE.CONNECTION_LOG}/stat`,
|
|
{ params },
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
async saveConnectionLog(
|
|
payload: ConnectionLogPayload,
|
|
): Promise<ConnectionLog> {
|
|
const response = await client.post<ConnectionLog>(
|
|
`${ENDPOINT.CMS_SERVICE.CONNECTION_LOG}`,
|
|
payload,
|
|
);
|
|
return response.data;
|
|
}
|
|
}
|
|
|
|
export const ConnectionLogApi = new ConnectionLogApiService();
|