mirror of
https://github.com/hay-kot/homebox.git
synced 2024-12-18 04:56:30 +00:00
feat: present loc/labels based on route (#162)
This commit is contained in:
parent
73c42f4784
commit
6af048dc93
1 changed files with 24 additions and 0 deletions
|
@ -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 toast = useNotifier();
|
||||
|
||||
|
@ -72,6 +88,14 @@
|
|||
() => modal.value,
|
||||
() => {
|
||||
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);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in a new issue