feat: present loc/labels based on route (#162)

This commit is contained in:
Hayden 2022-12-01 18:21:49 -09:00 committed by GitHub
parent 73c42f4784
commit 6af048dc93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -37,6 +37,22 @@
}, },
}); });
const route = useRoute();
const labelId = computed(() => {
if (route.fullPath.includes("/label/")) {
return route.params.id;
}
return null;
});
const locationId = computed(() => {
if (route.fullPath.includes("/location/")) {
return route.params.id;
}
return null;
});
const api = useUserApi(); const api = useUserApi();
const toast = useNotifier(); const toast = useNotifier();
@ -72,6 +88,14 @@
() => modal.value, () => modal.value,
() => { () => {
focused.value = true; focused.value = true;
if (locationId.value) {
form.location = locations.value.find(l => l.id === locationId.value);
}
if (labelId.value) {
form.labels = labels.value.filter(l => l.id === labelId.value);
}
} }
); );