|
|
@@ -95,12 +95,12 @@ import { parseISO, format } from 'date-fns'
|
|
|
import { fr } from 'date-fns/locale'
|
|
|
import type { ComputedRef } from 'vue'
|
|
|
import News from '~/models/Maestro/News'
|
|
|
-import { useEntityFetch } from '~/composables/data/useEntityFetch'
|
|
|
+import { useEntityManager } from '~/composables/data/useEntityManager'
|
|
|
|
|
|
const { mdAndUp, smAndDown } = useDisplay()
|
|
|
|
|
|
const route = useRoute()
|
|
|
-const { fetch } = useEntityFetch()
|
|
|
+const { em } = useEntityManager()
|
|
|
const config = useRuntimeConfig()
|
|
|
|
|
|
const newsId: number = parseInt(route.params.id as string)
|
|
|
@@ -108,8 +108,7 @@ if (!newsId || isNaN(newsId)) {
|
|
|
throw new Error('Missing or invalid id')
|
|
|
}
|
|
|
|
|
|
-// @ts-expect-error Until we can fix the typing of fetch
|
|
|
-const { data: newsItem, pending } = (await fetch(News, newsId)) as Ref<News>
|
|
|
+const newsItem = (await em.fetch(News, newsId, true)) as News
|
|
|
|
|
|
const getImageUrl = (attachment: string | null): string | null => {
|
|
|
if (!attachment) {
|
|
|
@@ -119,11 +118,11 @@ const getImageUrl = (attachment: string | null): string | null => {
|
|
|
}
|
|
|
|
|
|
const formattedPublicationDate: ComputedRef<string> = computed(() => {
|
|
|
- if (!newsItem.value || !newsItem.value.startPublication) {
|
|
|
+ if (!newsItem || !newsItem.startPublication) {
|
|
|
return ''
|
|
|
}
|
|
|
|
|
|
- const date = parseISO(newsItem.value.startPublication)
|
|
|
+ const date = parseISO(newsItem.startPublication)
|
|
|
|
|
|
let formattedPublicationDate = format(date, "'Le' dd MMMM yyyy", {
|
|
|
locale: fr,
|