import axios from "../config/axios";
import { createLog } from "./log";

export const addCabutSanksi = async (token, id, data) => {
	try {
		const res = await axios.post(`/sanksi/cabut-sanksi/create/${id}`, data, { headers: { Authorization: token } });
		await createLog(token, { aktivitas: `Berhasil mengajukan pencabutan sanksi, id: ${id}` });
		return res.data;
	} catch (error) {
		console.log("error", error);
		await createLog(token, { aktivitas: `Gagal mengajukan pencabutan sanksi, id: ${id}` });
		return false;
	}
};

export const addJawabanCabutSanksi = async (token, id, data) => {
	try {
		const res = await axios.post(`/sanksi/cabut-sanksi/jawaban/create/${id}`, data, { headers: { Authorization: token } });
		await createLog(token, { aktivitas: `Berhasil menjawab pengajuan pencabutan sanksi, id: ${id}` });
		return res.data;
	} catch (error) {
		console.log("error", error);
		await createLog(token, { aktivitas: `Gagal menjawab pengajuan pencabutan sanksi, id: ${id}` });
		return false;
	}
};
