@@ -197,7 +197,7 @@ for (const key in categories) {
197197 if (elem && checked !== undefined) elem.checked = checked;
198198 }
199199
200- async function updateJob(e) {
200+ async function updateJob(e: SubmitEvent ) {
201201 e.preventDefault();
202202 const data = createJobData();
203203
@@ -208,9 +208,10 @@ for (const key in categories) {
208208
209209 disableBtn();
210210 try {
211- const response = await fetch(`${backend_url}api/jobs/${jobId}`, {
211+ const payload = { ...data, id: jobId };
212+ const response = await fetch(`${backend_url}api/jobs/edit-job`, {
212213 method: "PUT",
213- body: JSON.stringify(data ),
214+ body: JSON.stringify(payload ),
214215 headers: { "Content-Type": "application/json" },
215216 });
216217 if (!response.ok) throw new Error("Update failed");
@@ -225,7 +226,7 @@ for (const key in categories) {
225226 if (!confirm("¿Estás seguro de que quieres eliminar este empleo? Esta acción no se puede deshacer.")) return;
226227
227228 try {
228- const response = await fetch(`${backend_url}api/jobs/${jobId}`, { method: "DELETE" });
229+ const response = await fetch(`${backend_url}api/jobs/delete-job?id= ${jobId}`, { method: "DELETE" });
229230 if (!response.ok) throw new Error("Delete failed");
230231 window.open(`${window.location.origin}/empleo-eliminado`, "_self");
231232 } catch (e) {
0 commit comments