redirect on create

This commit is contained in:
Hayden 2022-10-31 18:56:16 -08:00
parent 4a9d21d604
commit 8fd274c447
No known key found for this signature in database
GPG key ID: 17CF79474E257545
3 changed files with 6 additions and 2 deletions

View file

@ -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}`);
}
</script>

View file

@ -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}`);
}
</script>

View file

@ -64,5 +64,6 @@
toast.success("Location created");
}
reset();
navigateTo(`/location/${data.id}`);
}
</script>