forked from datagouv/cdata
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror.vue
More file actions
66 lines (59 loc) · 1.87 KB
/
error.vue
File metadata and controls
66 lines (59 loc) · 1.87 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<template>
<NuxtLayout>
<div class="fr-container fr-py-9v">
<div class="prose">
<template v-if="error && error.statusCode === 404">
<h1>{{ $t('Error 404') }}</h1>
<p>{{ $t("The page you're looking for cannot be found.") }}</p>
</template>
<template v-else>
<h1>{{ $t('Error') }}</h1>
<p>{{ $t('Something did not work as expected.') }}</p>
<p v-if="error">
<strong>{{ error.message }}</strong>
</p>
</template>
<p>
<a
class="fr-link fr-reset-link"
href="/"
>
{{ $t('Home') }}
</a>
</p>
</div>
</div>
</NuxtLayout>
</template>
<script setup lang="ts">
import { datagouv } from '@datagouv/components-next'
import type { UseFetchFunction } from '@datagouv/components-next'
import { NuxtLinkLocale, TextClamp } from '#components'
const error = useError()
const app = useNuxtApp()
const i18nHead = useLocaleHead()
const runtimeConfig = useRuntimeConfig()
app.vueApp.use(datagouv, {
name: runtimeConfig.public.title,
baseUrl: runtimeConfig.public.i18n.baseUrl, // Maybe do not use i18n config here?
apiBase: runtimeConfig.public.apiBase,
devApiKey: runtimeConfig.public.devApiKey,
staticUrl: runtimeConfig.public.staticUrl,
tabularApiUrl: 'https://tabular-api.data.gouv.fr',
tabularApiAllowRemote: true,
datasetQualityGuideUrl: runtimeConfig.public.datasetQualityGuideUrl,
customUseFetch: useAPI as UseFetchFunction, // Why this `as` is required?
textClamp: TextClamp,
appLink: NuxtLinkLocale,
})
useHeadSafe({
htmlAttrs: {
lang: i18nHead.value.htmlAttrs!.lang,
},
link: [...(i18nHead.value.link || [])],
meta: [...(i18nHead.value.meta || [])],
titleTemplate: (titleChunk) => {
return titleChunk ? `${titleChunk} - data.gouv.fr` : 'data.gouv.fr'
},
})
</script>