diff options
Diffstat (limited to 'fe/src/lib/forms/AddForm.svelte')
-rw-r--r-- | fe/src/lib/forms/AddForm.svelte | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/fe/src/lib/forms/AddForm.svelte b/fe/src/lib/forms/AddForm.svelte index f22e5f4..4520b1b 100644 --- a/fe/src/lib/forms/AddForm.svelte +++ b/fe/src/lib/forms/AddForm.svelte | |||
@@ -34,20 +34,23 @@ | |||
34 | dispatch("close"); | 34 | dispatch("close"); |
35 | } | 35 | } |
36 | 36 | ||
37 | async function handleSubmitStat() { | 37 | async function handleSubmitStat() |
38 | const response = await fetch("http://localhost:8080/api/v1/stats/", { | 38 | { |
39 | const { date, quantity } = statistic; | ||
40 | await fetch("http://localhost:8080/api/v1/stats/", { | ||
39 | method: "POST", | 41 | method: "POST", |
40 | headers: { | 42 | headers: { |
41 | Authorization: `Bearer ${$token}` | 43 | Authorization: `Bearer ${$token}` |
42 | }, | 44 | }, |
43 | body: JSON.stringify({ | 45 | body: JSON.stringify({ |
44 | date: new Date(), | 46 | date: new Date(date), |
45 | user_id: 1, | 47 | user_id: 2, |
46 | quantity: 3 | 48 | quantity |
47 | }) | 49 | }) |
48 | }); | 50 | }); |
49 | dispatch("submit"); | 51 | dispatch("submit"); |
50 | } | 52 | } |
53 | |||
51 | </script> | 54 | </script> |
52 | 55 | ||
53 | <dialog {open} on:submit={handleSubmitStat}> | 56 | <dialog {open} on:submit={handleSubmitStat}> |