@@ -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