diff --git a/frontend/components/Item/CreateModal.vue b/frontend/components/Item/CreateModal.vue
index b2ed85e..42bb6b7 100644
--- a/frontend/components/Item/CreateModal.vue
+++ b/frontend/components/Item/CreateModal.vue
@@ -10,7 +10,7 @@
:autofocus="true"
label="Item Name"
/>
-
+
@@ -81,13 +81,14 @@
}
const out: ItemCreate = {
+ parentId: undefined,
name: form.name,
description: form.description,
locationId: form.location.id as string,
labelIds: form.labels.map(l => l.id) as string[],
};
- const { error } = await api.items.create(out);
+ const { error, data } = await api.items.create(out);
if (error) {
toast.error("Couldn't create item");
return;
@@ -95,5 +96,6 @@
toast.success("Item created");
reset();
+ navigateTo(`/item/${data.id}`);
}
diff --git a/frontend/components/Label/CreateModal.vue b/frontend/components/Label/CreateModal.vue
index 99bfaa9..829ce8c 100644
--- a/frontend/components/Label/CreateModal.vue
+++ b/frontend/components/Label/CreateModal.vue
@@ -54,7 +54,7 @@
const toast = useNotifier();
async function create() {
- const { error } = await api.labels.create(form);
+ const { error, data } = await api.labels.create(form);
if (error) {
toast.error("Couldn't create label");
return;
@@ -62,5 +62,6 @@
toast.success("Label created");
reset();
+ navigateTo(`/label/${data.id}`);
}
diff --git a/frontend/components/Location/CreateModal.vue b/frontend/components/Location/CreateModal.vue
index 5d9713a..3503a0d 100644
--- a/frontend/components/Location/CreateModal.vue
+++ b/frontend/components/Location/CreateModal.vue
@@ -64,5 +64,6 @@
toast.success("Location created");
}
reset();
+ navigateTo(`/location/${data.id}`);
}