mirror of
https://github.com/Floriansylvain/RenewCMS.git
synced 2026-08-19 11:43:22 +02:00
Fix Articles front before table pagination impl.
This commit is contained in:
@@ -11,7 +11,20 @@ export interface Article {
|
||||
online: boolean
|
||||
}
|
||||
|
||||
export async function getArticles(id: string): Promise<Array<Article>> {
|
||||
export interface GetArticle {
|
||||
content: Article[],
|
||||
total: number
|
||||
pagination: {
|
||||
skip: number,
|
||||
take: number
|
||||
links: {
|
||||
next: string,
|
||||
previous: string
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function getArticles(id: string): Promise<GetArticle> {
|
||||
return await fetch(`${baseApiUrl}/articles/${id}`, {
|
||||
credentials: 'include',
|
||||
method: 'GET',
|
||||
|
||||
@@ -10,7 +10,7 @@ const table = ref<HTMLInputElement | string>('')
|
||||
const tabulator: Ref<Tabulator | undefined> = 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,
|
||||
|
||||
@@ -16,7 +16,7 @@ const errorModalDescription: Ref<string> = 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 => {
|
||||
|
||||
Reference in New Issue
Block a user