aboutsummaryrefslogtreecommitdiff
path: root/front-end/src/App.vue
blob: ecd9d73d1aed289e5e7b1c02c966b3dad7a8655d (plain)
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
37
38
39
40
41
42
<template>
  <head>
    <title>{{ metaTile }}</title>
  </head>
  <!-- Import environment component top level as the entrypoint -->
  <Environment @logout="logout()">
    <template #main>
      <router-view />
    </template>
  </Environment>
</template>

<script setup lang="ts">
import { computed } from 'vue';
import { useStore } from './store';
import { storeToRefs } from 'pinia';
import { apiCall } from '@vnuge/vnlib.browser';
import Environment from './bootstrap/Environment.vue';

const store = useStore()
const { siteTitle, pageTitle } = storeToRefs(store)

//Compute meta title from the default site title and the page title
const metaTile = computed(() => `${pageTitle.value} | ${siteTitle.value}`)

const logout = () => {
  apiCall(async () => {
    const { logout } = await store.socialOauth()
    await logout()
  })
}

store.setSiteTitle('CMNext Admin')
store.setPageTitle('Blog')

//Set header routes
store.setHeaderRouteNames(
  ['Login'],
  ['Blog', 'Account', 'Login']
)

</script>