mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
feat(FE-347): create product data dummy data
This commit is contained in:
@@ -22,6 +22,51 @@ import {
|
|||||||
} from '@/dummy/closing.dummy';
|
} from '@/dummy/closing.dummy';
|
||||||
import { httpClient, httpClientFetcher } from '@/services/http/client';
|
import { httpClient, httpClientFetcher } from '@/services/http/client';
|
||||||
import { ClosingSales } from '@/types/api/closing';
|
import { ClosingSales } from '@/types/api/closing';
|
||||||
|
import { sleep } from '@/lib/helper';
|
||||||
|
|
||||||
|
export const dummyClosingProductionResponse: BaseApiResponse<ClosingProductionData> =
|
||||||
|
{
|
||||||
|
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<Closing, null, null> {
|
export class ClosingApiService extends BaseApiService<Closing, null, null> {
|
||||||
constructor(basePath: string) {
|
constructor(basePath: string) {
|
||||||
@@ -137,12 +182,15 @@ export class ClosingApiService extends BaseApiService<Closing, null, null> {
|
|||||||
|
|
||||||
async getProductionData(id: number) {
|
async getProductionData(id: number) {
|
||||||
try {
|
try {
|
||||||
const getProductionDataPath = `${this.basePath}/${id}/production-data`;
|
// const getProductionDataPath = `${this.basePath}/${id}/production-data`;
|
||||||
const getProductionDataRes = await httpClient<
|
// const getProductionDataRes = await httpClient<
|
||||||
BaseApiResponse<ClosingProductionData>
|
// BaseApiResponse<ClosingProductionData>
|
||||||
>(getProductionDataPath);
|
// >(getProductionDataPath);
|
||||||
|
|
||||||
return getProductionDataRes;
|
// return getProductionDataRes;
|
||||||
|
|
||||||
|
await sleep(1000);
|
||||||
|
return dummyClosingProductionResponse;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (axios.isAxiosError<BaseApiResponse<ClosingProductionData>>(error)) {
|
if (axios.isAxiosError<BaseApiResponse<ClosingProductionData>>(error)) {
|
||||||
return error.response?.data;
|
return error.response?.data;
|
||||||
|
|||||||
Reference in New Issue
Block a user