18 lines
631 B
TypeScript
18 lines
631 B
TypeScript
import { getCookie } from "@/shared/lib";
|
|
import { CLAIM_NAME, AUTH_USER_ID } from "@/shared/config/env";
|
|
import axios from "axios";
|
|
import { PROXY_HOST, ENDPOINT } from "@/shared/config";
|
|
|
|
/**
|
|
* Common helper to delete attachment using cookies for auth headers.
|
|
*/
|
|
export async function deleteAttachment(atflId: string): Promise<void> {
|
|
if (!atflId) return;
|
|
const headers: Record<string, string> = {
|
|
[CLAIM_NAME]: getCookie(CLAIM_NAME) ?? "",
|
|
[AUTH_USER_ID]: getCookie(AUTH_USER_ID) ?? "",
|
|
};
|
|
const url = `${PROXY_HOST}${ENDPOINT.ATTACH_SERVICE.ATTACHMENTS}/${atflId}`;
|
|
await axios.delete(url, { headers });
|
|
}
|