diff --git a/web/admin-gui/src/utils/database.ts b/web/admin-gui/src/utils/database.ts index 5a0ddaf..4114451 100644 --- a/web/admin-gui/src/utils/database.ts +++ b/web/admin-gui/src/utils/database.ts @@ -11,7 +11,20 @@ export interface Article { online: boolean } -export async function getArticles(id: string): Promise> { +export interface GetArticle { + content: Article[], + total: number + pagination: { + skip: number, + take: number + links: { + next: string, + previous: string + } + } +} + +export async function getArticles(id: string): Promise { return await fetch(`${baseApiUrl}/articles/${id}`, { credentials: 'include', method: 'GET', diff --git a/web/admin-gui/src/views/Articles.vue b/web/admin-gui/src/views/Articles.vue index 4c6fc4f..05525cf 100644 --- a/web/admin-gui/src/views/Articles.vue +++ b/web/admin-gui/src/views/Articles.vue @@ -10,7 +10,7 @@ const table = ref('') const tabulator: Ref = ref(undefined) onMounted(async () => { - articles.value = await getArticles('') + articles.value = await (await getArticles('')).content tabulator.value = new Tabulator(table.value, { data: articles.value, reactiveData: true, diff --git a/web/admin-gui/src/views/ArticlesEdit.vue b/web/admin-gui/src/views/ArticlesEdit.vue index 1705836..4448a40 100644 --- a/web/admin-gui/src/views/ArticlesEdit.vue +++ b/web/admin-gui/src/views/ArticlesEdit.vue @@ -16,7 +16,7 @@ const errorModalDescription: Ref = ref("Quelque chose s'est mal passé.. onMounted(async () => { await getArticles(useRoute().params.articleID as string) .then(articleFetch => { - article.value = articleFetch[0] + article.value = articleFetch.content[0] editorData.value = article.value.content.html }) .catch(error => {