This repository has been archived on 2025-09-22. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
2025SELab2-project-Dwengo/frontend/src/App.vue

27 lines
703 B
Vue

<script setup lang="ts">
import auth from "@/services/auth/auth-service.ts";
import MenuBar from "@/components/MenuBar.vue";
import { useRoute } from "vue-router";
import { computed } from "vue";
import authService from "@/services/auth/auth-service.ts";
void authService.loadUser();
const route = useRoute();
interface RouteMeta {
requiresAuth?: boolean;
}
const showMenuBar = computed(() => (route.meta as RouteMeta).requiresAuth && auth.authState.user);
</script>
<template>
<v-app>
<menu-bar v-if="showMenuBar"></menu-bar>
<v-main>
<router-view />
</v-main>
</v-app>
</template>
<style scoped></style>