forked from fastify/pacchetto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient.vue
43 lines (36 loc) · 787 Bytes
/
client.vue
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
43
<template>
<template v-if="error">
<Error :error="error" />
</template>
<template v-else>
<Router />
</template>
</template>
<script>
import { computed, onErrorCaptured } from 'vue'
import { useHead } from '@vueuse/head'
import { useIsomorphic } from 'fastify-vite-vue/app'
import Router from '@app/router.vue'
import Error from '@app/error.vue'
import * as head from '@app/head.js'
export default {
components: {
Error,
Router,
},
setup() {
const ctx = useIsomorphic()
if (typeof head?.default === 'function') {
useHead(head.default(ctx))
} else {
useHead(head.default ?? head)
}
onErrorCaptured((error) => {
ctx.$error = error
})
return {
error: computed(() => ctx.$error)
}
},
}
</script>