Skip to content

Commit 5de7793

Browse files
testing with headers for post methods
1 parent c2ae5b0 commit 5de7793

1 file changed

Lines changed: 22 additions & 21 deletions

File tree

src/pages/nuevo-empleo.astro

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ for (const key in categories) {
4242
>
4343
<span class="sr-only">Info</span>
4444
<div>
45-
<span class="font-medium">Antes de publicar su anuncio, asegúrese de respetar las siguientes normas para no ser baneado de la plataforma.</span>
45+
<span class="font-medium"
46+
>Antes de publicar su anuncio, asegúrese de respetar las siguientes normas para no ser baneado de la plataforma.</span
47+
>
4648
<ul class="mt-1.5 ml-4 list-disc list-inside">
4749
<li>Solo publicar ofertas de trabajo.</li>
4850
<li>No publicar candidaturas (Que estas buscando trabajo).</li>
@@ -52,20 +54,20 @@ for (const key in categories) {
5254
</ul>
5355
</div>
5456
<button
55-
type="button"
56-
class="ml-auto -mx-1.5 -my-1.5 bg-blue-50 text-blue-500 rounded-lg focus:ring-2 focus:ring-blue-400 p-1.5 hover:bg-blue-200 inline-flex h-8 w-8 dark:bg-gray-800 dark:text-blue-300 dark:hover:bg-gray-700"
57-
data-dismiss-target="#newJobsAlert"
58-
aria-label="Close"
59-
id="closeNewJobsAlert"
60-
>
61-
<span class="sr-only">Close</span>
62-
<svg aria-hidden="true" class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"
63-
><path
64-
fill-rule="evenodd"
65-
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
66-
clip-rule="evenodd"></path></svg
57+
type="button"
58+
class="ml-auto -mx-1.5 -my-1.5 bg-blue-50 text-blue-500 rounded-lg focus:ring-2 focus:ring-blue-400 p-1.5 hover:bg-blue-200 inline-flex h-8 w-8 dark:bg-gray-800 dark:text-blue-300 dark:hover:bg-gray-700"
59+
data-dismiss-target="#newJobsAlert"
60+
aria-label="Close"
61+
id="closeNewJobsAlert"
6762
>
68-
</button>
63+
<span class="sr-only">Close</span>
64+
<svg aria-hidden="true" class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"
65+
><path
66+
fill-rule="evenodd"
67+
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
68+
clip-rule="evenodd"></path></svg
69+
>
70+
</button>
6971
</div>
7072
</div>
7173

@@ -174,12 +176,7 @@ for (const key in categories) {
174176
e.preventDefault();
175177
const data = createJobData();
176178

177-
if (
178-
!data.applyEmail &&
179-
!data.applyUrl &&
180-
!data.applyTelegramUser &&
181-
!data.applyPhone
182-
) {
179+
if (!data.applyEmail && !data.applyUrl && !data.applyTelegramUser && !data.applyPhone) {
183180
showToast(
184181
"Debe proporcionar al menos un método de contacto (Correo Electrónico, URL, Usuario de Telegram o Número Telefónico).",
185182
true
@@ -209,7 +206,11 @@ for (const key in categories) {
209206

210207
disableBtn();
211208
try {
212-
const response = await fetch(backend_url + "api/jobs/new-job", { method: "POST", body: JSON.stringify(data) });
209+
const response = await fetch(backend_url + "api/jobs/new-job", {
210+
method: "POST",
211+
body: JSON.stringify(data),
212+
headers: { "Content-Type": "application/json" },
213+
});
213214
const responseData = await response.json();
214215
if (responseData.data && responseData.data.id) {
215216
window.open(`${window.location.origin}/empleo-publicado?id=${responseData.data.id}`, "_self");

0 commit comments

Comments
 (0)