Working and clean fucking guestbook

This commit is contained in:
2021-08-20 11:58:44 +02:00
parent 28990e0151
commit 2f50ad9d55
20 changed files with 103 additions and 530 deletions

View File

@@ -6,8 +6,8 @@
</h3>
<div v-if="formations" v-for="formation in formations">
<Formation
:title="formation.title"
:description="formation.description"
:title="formation.title.code"
:description="formation.description.code"
:location="formation.location"
:begin="formation.begin_date"
:end="formation.end_date" />
@@ -22,15 +22,20 @@ import {Formation} from "~/types/types";
export default defineComponent({
name: "FormationsHome",
setup() {
const {$content, $sentry} = useContext()
const {$axios, $sentry, app} = useContext()
const formations = useAsync(() => {
return $content('formations')
.sortBy('end_date', 'desc')
.fetch<Formation>()
.catch((error) => {
$sentry.captureEvent(error)
})
const formations = useAsync(async () => {
const response = await $axios.get('/api/formations', {
headers: {
'Authorization': `Bearer ${process.env.API_TOKEN}`
}
})
if (response.status === 200) {
return response.data.formations
} else {
app.error({statusCode: 500})
$sentry.captureEvent(response.data)
}
}, 'formations')
return {