diff --git a/src/services/api/base.ts b/src/services/api/base.ts index 2fcf3712..6a3fdfa4 100644 --- a/src/services/api/base.ts +++ b/src/services/api/base.ts @@ -15,6 +15,22 @@ export class BaseApiService { return await httpClientFetcher>(endpoint); } + async getAll(query?: Record) { + try { + const getAllPath = this.basePath; + const getAllRes = await httpClient>(getAllPath, { + query, + }); + + return getAllRes; + } catch (error) { + if (axios.isAxiosError>(error)) { + return error.response?.data; + } + return undefined; + } + } + async getSingle(id: number) { try { const getSinglePath = `${this.basePath}/${id}`;