28 lines
857 B
TypeScript
28 lines
857 B
TypeScript
import { client } from "@/shared/api";
|
|
import { ENDPOINT } from "@/shared/config";
|
|
|
|
import type { Code, CodeService } from "../model/code-interface";
|
|
|
|
async function getList(upCd: string): Promise<Code[]> {
|
|
const response = await client.get<Code[]>(`${ENDPOINT.CMS_SERVICE.CODE}/${upCd}`);
|
|
return response.data;
|
|
}
|
|
|
|
async function getListByUseYn(upCd: string, useYn: string): Promise<Code[]> {
|
|
const response = await client.get<Code[]>(`${ENDPOINT.CMS_SERVICE.CODE}/${upCd}/${useYn}`);
|
|
return response.data;
|
|
}
|
|
|
|
async function getCodeName(upCd: string, lwpoCd: string): Promise<string> {
|
|
const response = await client.get<string>(
|
|
`${ENDPOINT.CMS_SERVICE.CODE}/${upCd}/lwpoCd/${lwpoCd}`,
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
export const codeService = {
|
|
getList,
|
|
getListByUseYn,
|
|
getCodeName,
|
|
} satisfies CodeService;
|