mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-21 22:05:45 +00:00
feat(FE-337): init slicing UI and define data types
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
import axios from 'axios';
|
||||
import { BaseApiService } from '@/services/api/base';
|
||||
import { BaseApiResponse } from '@/types/api/api-general';
|
||||
import { httpClient } from '@/services/http/client';
|
||||
import { Finance } from '@/types/api/finance/finance';
|
||||
// DUMMY_START
|
||||
import {
|
||||
getAllDummyFinance,
|
||||
getSingleDummyFinance,
|
||||
} from '@/dummy/finance/finance.dummy';
|
||||
// DUMMY_END
|
||||
|
||||
export class FinanceApiService extends BaseApiService<
|
||||
Finance,
|
||||
unknown,
|
||||
unknown
|
||||
> {
|
||||
constructor(basePath: string) {
|
||||
super(basePath);
|
||||
}
|
||||
|
||||
async getAllFetcher(): Promise<BaseApiResponse<Finance[]>> {
|
||||
// DUMMY_START
|
||||
return await getAllDummyFinance();
|
||||
// DUMMY_END
|
||||
|
||||
// LIVE_START
|
||||
// try {
|
||||
// const path = `${this.basePath}/`;
|
||||
// return await httpClient<BaseApiResponse<Finance[]>>(path);
|
||||
// } catch (error) {
|
||||
// if (axios.isAxiosError<BaseApiResponse<Finance[]>>(error)) {
|
||||
// return error.response?.data;
|
||||
// }
|
||||
// return undefined;
|
||||
// }
|
||||
// LIVE_END
|
||||
}
|
||||
|
||||
async getSingleFetcher(id: string): Promise<BaseApiResponse<Finance>> {
|
||||
// DUMMY_START
|
||||
console.log(id);
|
||||
return await getSingleDummyFinance(id);
|
||||
// DUMMY_END
|
||||
|
||||
// LIVE_START
|
||||
// try {
|
||||
// const path = `${this.basePath}/`;
|
||||
// return await httpClient<BaseApiResponse<Finance[]>>(path);
|
||||
// } catch (error) {
|
||||
// if (axios.isAxiosError<BaseApiResponse<Finance[]>>(error)) {
|
||||
// return error.response?.data;
|
||||
// }
|
||||
// return undefined;
|
||||
// }
|
||||
// LIVE_END
|
||||
}
|
||||
}
|
||||
|
||||
export const FinanceApi = new FinanceApiService('/finances');
|
||||
Reference in New Issue
Block a user