Files
NSG_PORTAL_V2/stores/articles.ts
T

19 lines
543 B
TypeScript
Raw Normal View History

2024-05-31 00:46:43 +07:00
export const useArticleStore = defineStore("article", () => {
const currentArticle = ref<any>({});
const getArticleById = async (id: string | number) => {
try {
const { data } = await useFetch(`/api/articles/get-by-id/${id}`)
currentArticle.value = {}
currentArticle.value = data.value
} catch (error: any) {}
}
return {
currentArticle,
getArticleById
}
});
import.meta.hot && import.meta.hot.accept(acceptHMRUpdate(useArticleStore, import.meta.hot));