feat: api for fetching api services

This commit is contained in:
2025-05-30 21:25:15 +02:00
parent 1ab4113040
commit 8a28fca3d9

View File

@ -1,8 +1,18 @@
import { axios } from ".."
import type { ApiService } from "@/types";
import { axios, handleApiError } from "..";
export interface FetchApiServicesRequest {}
export const fetchApiServices = async (req: FetchApiServicesRequest) => {
const response = await axios.get()
export interface FetchApiServicesResponse {
items: ApiService[];
count: number;
}
export const getApiServices = async (): Promise<FetchApiServicesResponse> => {
const response = await axios.get<FetchApiServicesResponse>(
"/api/v1/admin/api-services",
);
if (response.status !== 200 && response.status !== 201)
throw await handleApiError(response);
return response.data;
};