-
-
Notifications
You must be signed in to change notification settings - Fork 365
/
Copy pathshow.vue
25 lines (23 loc) · 785 Bytes
/
show.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<script lang="ts" setup>
const router = useRouter();
const route = useRoute();
const store = useContainerStore();
const { visibleContainers } = storeToRefs(store);
watch(visibleContainers, (newValue) => {
if (newValue) {
if (route.query.name) {
const [container, _] = visibleContainers.value.filter((c) => c.name == route.query.name);
if (container) {
router.push({ name: "/container/[id]", params: { id: container.id } });
} else {
console.error(`No containers found matching name=${route.query.name}. Redirecting to /`);
router.push({ name: "/" });
}
} else {
console.error(`Expection query parameter name to be set. Redirecting to /`);
router.push({ name: "/" });
}
}
});
</script>
<template></template>