diff --git a/src/services/api/closing.ts b/src/services/api/closing.ts index 2511a4f9..279cdd7c 100644 --- a/src/services/api/closing.ts +++ b/src/services/api/closing.ts @@ -22,6 +22,51 @@ import { } from '@/dummy/closing.dummy'; import { httpClient, httpClientFetcher } from '@/services/http/client'; import { ClosingSales } from '@/types/api/closing'; +import { sleep } from '@/lib/helper'; + +export const dummyClosingProductionResponse: BaseApiResponse = + { + code: 200, + status: 'success', + message: 'Closing production data fetched successfully', + data: { + purchase: { + initial_population: 10_000, + claim_culling: 150, + final_population: 9_850, + feed_in_kg: 18_000, + feed_used_kg: 17_200, + feed_used_per_head_kg: 1.75, + }, + + sales: { + sales_kg: 18_500, + sales_head: 9_600, + average_weight_kg: 1.93, + average_price_per_kg: 20_500, + }, + + performance: { + depletion_head: 400, + depletion_percentage: 4, + age_days: 35, + mortality_std: 3.5, + mortality_act: 4, + deff_mortality: 0.5, + fcr_std: 1.6, + fcr_act: 1.72, + deff_fcr: 0.12, + adg: 55, + ip: 320, + }, + + variance: { + variance_head: -250, + variance_head_percentage: -2.5, + variance_feed_kg: -800, + }, + }, + }; export class ClosingApiService extends BaseApiService { constructor(basePath: string) { @@ -137,12 +182,15 @@ export class ClosingApiService extends BaseApiService { async getProductionData(id: number) { try { - const getProductionDataPath = `${this.basePath}/${id}/production-data`; - const getProductionDataRes = await httpClient< - BaseApiResponse - >(getProductionDataPath); + // const getProductionDataPath = `${this.basePath}/${id}/production-data`; + // const getProductionDataRes = await httpClient< + // BaseApiResponse + // >(getProductionDataPath); - return getProductionDataRes; + // return getProductionDataRes; + + await sleep(1000); + return dummyClosingProductionResponse; } catch (error) { if (axios.isAxiosError>(error)) { return error.response?.data;