Commit 3f6fd641 authored by Dannon Baker's avatar Dannon Baker
Browse files

Refactor WorkflowLanding component to load user data on mount and close...

Refactor WorkflowLanding component to load user data on mount and close sidebar, removing redundant user store logic.
parent bcac2a06
Loading
Loading
Loading
Loading
+33 −51
Original line number Diff line number Diff line
<script setup lang="ts">
import { BAlert } from "bootstrap-vue";
import { storeToRefs } from "pinia";
import { ref, watch } from "vue";
import { useRouter } from "vue-router/composables";
import { onMounted, ref } from "vue";

import { GalaxyApi } from "@/api";
import { useActivityStore } from "@/stores/activityStore";
import { useUserStore } from "@/stores/userStore";
import { errorMessageAsString } from "@/utils/simple-error";

import LoadingSpan from "@/components/LoadingSpan.vue";
@@ -27,25 +24,12 @@ const workflowId = ref<string | null>(null);
const errorMessage = ref<string | null>(null);
const requestState = ref<Record<string, never> | null>(null);
const instance = ref<boolean>(false);
const userStore = useUserStore();
const router = useRouter();

userStore.loadUser(false);
const { isAnonymous, currentUser } = storeToRefs(userStore);

const activityStore = useActivityStore("default");

watch(
    currentUser,
    async () => {
        if (isAnonymous.value) {
            router.push(
                `/login/start?redirect=/workflow_landings/${props.uuid}?public=${props.public}&client_secret=${props.secret}`
            );
        } else if (currentUser.value) {
onMounted(async() => {
    let claim;
    let claimError;
            activityStore.closeSideBar();
    if (props.public) {
        const { data, error } = await GalaxyApi().GET("/api/workflow_landings/{uuid}", {
            params: {
@@ -73,10 +57,8 @@ watch(
    } else {
        errorMessage.value = errorMessageAsString(claimError);
    }
        }
    },
    { immediate: true }
);
    activityStore.closeSideBar();
});
</script>

<template>
+1 −2
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ import CreateFileSourceInstance from "@/components/FileSources/Instances/CreateI
import GridHistory from "@/components/Grid/GridHistory";
import GridPage from "@/components/Grid/GridPage";
import CreateObjectStoreInstance from "@/components/ObjectStore/Instances/CreateInstance";
import { useUserStore } from "@/stores/userStore";
import { parseBool } from "@/utils/utils";

import { patchRouterPush } from "./router-push";
@@ -535,8 +536,6 @@ export function getRouter(Galaxy) {
                                });
                                return;
                            }
                            // const activityStore = useActivityStore("default");
                            // activityStore.closeSideBar();
                            next();
                        },
                    },