interface ArticleCondition { ids?: number[] } export const useArticleStore = defineStore("article", () => { const currentArticle = ref({}); const currentArticles = ref([]) const getArticleById = async (id: string | number) => { try { const { data} = await useFetch(`/api/articles/get-by-id/${id}`) currentArticle.value = {} currentArticle.value = data.value.item } catch (error: any) {} } const getArticleBySlug = async (slug: string) => { try { const { data: article } = await useAsyncData('article', () => $fetch(`/api/articles/get-by-slug/${slug}`)) currentArticle.value = {} currentArticle.value = article.value?.item } catch (error: any) {} } const getArticleCondition = async (condition: ArticleCondition) => { try { const { data: articles } = await useFetch(`/api/articles/condition`, { method: 'POST', body: condition }) } catch (error: any) { } } return { currentArticle, getArticleById, getArticleBySlug, getArticleCondition } }); import.meta.hot && import.meta.hot.accept(acceptHMRUpdate(useArticleStore, import.meta.hot));