minhnt-dev: design
This commit is contained in:
+10
-1
@@ -10,9 +10,18 @@ export const useArticleStore = defineStore("article", () => {
|
||||
} catch (error: any) {}
|
||||
}
|
||||
|
||||
const getArticleByCode = async (slug: string) => {
|
||||
try {
|
||||
const { data} = await useFetch(`/api/articles/get-by-slug/${slug}`)
|
||||
currentArticle.value = {}
|
||||
currentArticle.value = data.value.item
|
||||
} catch (error: any) {}
|
||||
}
|
||||
|
||||
return {
|
||||
currentArticle,
|
||||
getArticleById
|
||||
getArticleById,
|
||||
getArticleByCode
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user