import services from '../services' ; import { Article } from '../types/article.interface' ; export type ArticleState = Article | null ; export const article = { state : null as ArticleState , reducers : { setArticle ( state , payload ) { return payload ; } , } , effects : { async getArticle ( state , payload ) { return services . article . visitor . getArticle ( payload ) ; } , async getAdminArticle ( state , payload ) { return services . article . user . getArticle ( payload ) ; } , async createArticle ( state , payload ) { return services . article . user . createArticle ( payload ) ; } , async updateArticle ( state , payload ) { await services . article . user . updateArticle ( payload ) ; return services . article . user . getArticle ( { article_id : payload . article_id } ) ; } , async deleteArticle ( state , payload ) { return services . article . user . deleteArticle ( payload ) ; } } , } ;