Skip to content

Commit

Permalink
return error
Browse files Browse the repository at this point in the history
  • Loading branch information
allurei committed Dec 28, 2024
1 parent 1fb3ff7 commit 3ac5aec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/lib/components/ilmoformi.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
<div class="wrap">
<div class="flex-items bordered flower-bg">
<h2>Ilmoittautuminen</h2>
{#if form?.error}
{console.log(form?.error)}
{/if}
{#if form?.success !== true}
<form method="POST" use:enhance>
<div class="flex-item twelve row">
Expand Down
8 changes: 7 additions & 1 deletion src/routes/tesmi/kutsuvieras-ilmo/+page.server.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const actions = {
let body = {};
data.forEach((value, key) => body[key] = value);
body = JSON.stringify(body);

try {
const response = await fetch('https://api.viiskyt.asteriski.fi/api/participants/', {
method: 'POST',
headers: { "Content-Type": "application/json" },
Expand All @@ -30,5 +30,11 @@ export const actions = {
return fail(400, {
success: false
});
} catch (error) {
console.error(error);
return {
error
}
}
},
};

0 comments on commit 3ac5aec

Please sign in to comment.