-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
121 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
<script> | ||
import Ilmoformi from "$lib/components/ilmoformi.svelte"; | ||
export let id = 'ilmo'; | ||
export let form; | ||
export let invited = false | ||
</script> | ||
|
||
<Ilmoformi invited={true} id /> | ||
<Ilmoformi {invited} {id} {form} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
<script> | ||
import Ilmo from "$lib/components/ilmo.svelte"; | ||
export let form; | ||
</script> | ||
|
||
|
||
|
||
<Ilmo /> | ||
<Ilmo {form}/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { fail } from '@sveltejs/kit'; | ||
|
||
export const actions = { | ||
invited: async ({ request }) => { | ||
const data = await request.formData(); | ||
|
||
let body = {}; | ||
data.forEach((value, key) => body[key] = value); | ||
body = JSON.stringify(body); | ||
|
||
const response = await fetch('https://api.viiskyt.asteriski.fi/api/participants/', { | ||
method: 'POST', | ||
headers: { "Content-Type": "application/json" }, | ||
body | ||
}) | ||
|
||
const res = await response.json(); | ||
|
||
if (response.ok) { | ||
return { | ||
success: true, | ||
}; | ||
} | ||
if (res?.non_field_errors[0] === 'Ilmoittautuminen ei ole auki') { | ||
return fail(400, { | ||
success: false, | ||
ilmo: false | ||
}); | ||
} | ||
return fail(400, { | ||
success: false | ||
}); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<script> | ||
import Ilmo from "$lib/components/ilmo.svelte"; | ||
export let form; | ||
</script> | ||
|
||
<Ilmo {form} invited={true}/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters