thainv-dev: fix ui

This commit is contained in:
nguyen van thai
2024-06-04 15:03:54 +07:00
parent 0729e021bd
commit a0a5651ac0
10 changed files with 62 additions and 18 deletions
+18 -1
View File
@@ -1,5 +1,9 @@
interface ArticleCondition {
ids?: number[]
}
export const useArticleStore = defineStore("article", () => {
const currentArticle = ref<any>({});
const currentArticles = ref<any[]>([])
const getArticleById = async (id: string | number) => {
try {
@@ -18,10 +22,23 @@ export const useArticleStore = defineStore("article", () => {
} catch (error: any) {}
}
const getArticleCondition = async (condition: ArticleCondition) => {
try {
const { data: articles } = await useFetch(`/api/articles/condition`, {
method: 'POST',
body: condition
})
console.log(articles, 'data')
} catch (error: any) {
}
}
return {
currentArticle,
getArticleById,
getArticleBySlug
getArticleBySlug,
getArticleCondition
}
});