23 lines
703 B
TypeScript
23 lines
703 B
TypeScript
import { AxiosResponse } from "axios";
|
|
|
|
import { client } from "@/shared/api";
|
|
import { ENDPOINT } from "@/shared/config";
|
|
|
|
import type { AttachService } from "../model/attach-interface";
|
|
|
|
async function deleteAttachmentByAtflId(atflId: string): Promise<void> {
|
|
if (!atflId) return;
|
|
await client.delete(`${ENDPOINT.ATTACH_SERVICE.ATTACHMENTS}/${atflId}`);
|
|
}
|
|
|
|
async function downloadAttachmentByAtflCd(atflCd: string): Promise<AxiosResponse> {
|
|
return await client.get<Blob>(`${ENDPOINT.ATTACH_SERVICE.DOWNLOAD}/${atflCd}`, {
|
|
responseType: "blob",
|
|
});
|
|
}
|
|
|
|
export const attachService = {
|
|
deleteAttachmentByAtflId,
|
|
downloadAttachmentByAtflCd,
|
|
} satisfies AttachService;
|