minhnt-dev: article api

This commit is contained in:
MoreStrive
2024-05-31 00:46:43 +07:00
parent a7d4781a81
commit 7a92ca829f
11 changed files with 229 additions and 60 deletions
+10 -8
View File
@@ -6,17 +6,19 @@ export const useDynamicPageStore = defineStore("dynamicPageStore", () => {
const componentPublished = ref<any[]>([]);
async function fetchPageByCode(slug: any) {
try {
const { data } = await useFetch(`/api/services/get-by-code/${slug}`)
currentPage.value = data.value
} catch (error: any) {}
try {
const { data } = await useFetch(`/api/dynamic-page/get-by-code/${slug}`)
currentPage.value = {}
currentPage.value = data.value
} catch (error: any) {}
}
async function fetchPageById(id: string | number) {
try {
const {data} = await useFetch(`/api/services/get-by-id/${id}`)
currentPage.value = data.value
} catch (error: any) {}
try {
const { data } = await useFetch(`/api/dynamic-page/get-by-id/${id}`)
currentPage.value = {}
currentPage.value = data.value
} catch (error: any) {}
}
const setSectionPublished = () => {