From bc424b7a0043aa22145832b8d8ce58a213c02534 Mon Sep 17 00:00:00 2001 From: James Collins Date: Fri, 21 Jul 2023 11:25:35 +1000 Subject: [PATCH] update event to new attachments API --- resources/js/views/dashboard/EventEdit.vue | 30 ++++++++-------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/resources/js/views/dashboard/EventEdit.vue b/resources/js/views/dashboard/EventEdit.vue index 14b5ff5..c5f263a 100644 --- a/resources/js/views/dashboard/EventEdit.vue +++ b/resources/js/views/dashboard/EventEdit.vue @@ -31,24 +31,24 @@
@@ -96,7 +96,7 @@ - +
{ form.controls.price.value = data.event.price; form.controls.ages.value = data.event.ages; - attachments.value = (data.event.attachments || []).map( - function (attachment) { - return attachment.id.toString(); - }, - ); + attachments.value = data.event.attachments; } catch (err) { pageError.value = err.status; } finally { @@ -330,6 +326,7 @@ const handleSubmit = async () => { hero: form.controls.hero.value.id, price: form.controls.price.value, ages: form.controls.ages.value, + attachments: attachments.value.map((item) => item.id), }; let event_id = ""; @@ -355,13 +352,6 @@ const handleSubmit = async () => { } } - await api.put({ - url: `/events/${event_id}/attachments`, - body: { - attachments: attachments.value, - }, - }); - useToastStore().addToast({ title: route.params.id ? "Event Updated" : "Event Created", content: route.params.id