Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | 4x 1x 1x 1x 4x 2x 2x 2x 2x 2x 2x | import { REQUEST_POLICY, runRequestEffect } from '@repo/services/effectRequest';
import { ENDPOINTS } from '@/constants/apis';
import { RequestDetailResponse } from '@/types/request';
import { https } from '@/services/mainHttpClient';
export const getRequest = async (id: string) => {
return runRequestEffect(async () => {
const response = await https.get<RequestDetailResponse>(`${ENDPOINTS.LIST_REQUESTS}/${id}`);
return response.data;
}, REQUEST_POLICY.READ);
};
export const createOutcome = async (
id: string,
data: {
state: string;
note?: string;
},
) => {
const form = new FormData();
form.append('state', data.state);
if (data.note) form.append('note', data.note);
return runRequestEffect(async () => {
const response = await https.post(`${ENDPOINTS.LIST_REQUESTS}/${id}/outcomes`, form);
return response.data;
}, REQUEST_POLICY.WRITE);
};
|