mirror of
https://github.com/Floriansylvain/RenewCMS.git
synced 2026-08-19 19:53:21 +02:00
Article GET route now returns Array
This commit is contained in:
@@ -13,7 +13,7 @@ export interface Article {
|
||||
|
||||
const baseURL = `http://${__APP_ENV__.APP_HOST_ADDRESS}:${__APP_ENV__.APP_API_PORT}`
|
||||
|
||||
export async function getArticle(id: string) : Promise<Article> {
|
||||
export async function getArticles(id: string) : Promise<Array<Article>> {
|
||||
return await fetch(`${baseURL}/articles/${id}`, {
|
||||
method: 'GET',
|
||||
headers: { "Authorization": `Bearer ${useAuthStore().token}` }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { getArticle, type Article } from '@/utils/database';
|
||||
import { getArticles, type Article } from '@/utils/database';
|
||||
import Editor from '@tinymce/tinymce-vue';
|
||||
import { onMounted, ref, type Ref } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
@@ -8,7 +8,8 @@ const article: Ref<Article | void> = ref()
|
||||
const editorData: Ref<string> = ref('')
|
||||
|
||||
onMounted(async () => {
|
||||
article.value = await getArticle(useRoute().params.articleID as string)
|
||||
const articleFetch = await getArticles(useRoute().params.articleID as string)
|
||||
article.value = articleFetch[0]
|
||||
editorData.value = article.value.content.html
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user