Trigger redirct before rendering form

This commit is contained in:
mvdbeek
2024-05-20 10:27:07 +02:00
parent d613130cd3
commit f3a554743e
+5 -8
View File
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { BAlert } from "bootstrap-vue";
import { computed, onMounted } from "vue";
import { computed } from "vue";
import { useRouter } from "vue-router/composables";
import { useConfig } from "@/composables/config";
@@ -22,13 +22,10 @@ const responseVal = computed(() => jobStore.getLatestResponse);
const showRecommendation = computed(() => config.value.enable_tool_recommendations);
const toolName = computed(() => responseVal.value.toolName);
/* lifecyle */
onMounted(() => {
// no response means that no tool was run in this session i.e. no data in the store
if (Object.keys(responseVal.value).length === 0) {
router.push(`/`);
}
});
// no data means that no tool was run in this session i.e. no data in the store
if (Object.keys(responseVal.value).length === 0) {
router.push(`/`);
}
</script>
<template>