All files / src/app AppShell.vue

0% Statements 0/8
0% Branches 0/7
0% Functions 0/2
0% Lines 0/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 26 27 28 29 30 31 32 33 34 35 36                                                                       
<script setup lang="ts">
import { watch } from "vue";
import { RouterView } from "vue-router";
import { useRoute, useRouter } from "vue-router";
 
import { useSessionStore } from "../features/customer-session";
import AppFooter from "./AppFooter.vue";
import AppHeader from "./AppHeader.vue";
 
const route = useRoute();
const router = useRouter();
const session = useSessionStore();
 
watch(() => session.reauthRequired, (required) => {
  if (required && route.name !== "login" && route.name !== "register") {
    void router.replace({
      name: "login",
      query: { returnTo: route.fullPath },
    });
  }
});
</script>
 
<template>
  <a class="pj-skip-link" href="#main-content">跳到主要内容</a>
  <div class="pj-app-shell storefront-shell">
    <AppHeader />
    <main id="main-content" class="pj-app-main" tabindex="-1">
      <RouterView />
    </main>
    <AppFooter />
  </div>
</template>
 
<style src="./app-shell.css"></style>