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
|
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}`, {
|
return await fetch(`${baseApiUrl}/articles/${id}`, {
|
||||||
credentials: 'include',
|
credentials: 'include',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ const table = ref<HTMLInputElement | string>('')
|
|||||||
const tabulator: Ref<Tabulator | undefined> = ref(undefined)
|
const tabulator: Ref<Tabulator | undefined> = ref(undefined)
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
articles.value = await getArticles('')
|
articles.value = await (await getArticles('')).content
|
||||||
tabulator.value = new Tabulator(table.value, {
|
tabulator.value = new Tabulator(table.value, {
|
||||||
data: articles.value,
|
data: articles.value,
|
||||||
reactiveData: true,
|
reactiveData: true,
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ const errorModalDescription: Ref<string> = ref("Quelque chose s'est mal passé..
|
|||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await getArticles(useRoute().params.articleID as string)
|
await getArticles(useRoute().params.articleID as string)
|
||||||
.then(articleFetch => {
|
.then(articleFetch => {
|
||||||
article.value = articleFetch[0]
|
article.value = articleFetch.content[0]
|
||||||
editorData.value = article.value.content.html
|
editorData.value = article.value.content.html
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
|||||||
Reference in New Issue
Block a user