feature/improved-article-content-loading #179
@ -20,8 +20,8 @@ const useArticleCommonStore = (): ArticleStore => {
|
||||
setError(true);
|
||||
return null;
|
||||
}
|
||||
setLoading(false);
|
||||
setCurrentArticle(fromStore);
|
||||
setLoading(false);
|
||||
return fromStore;
|
||||
}
|
||||
setLoading(false);
|
||||
|
@ -17,13 +17,13 @@ const articleReducer = (
|
||||
): ArticleStoreState => {
|
||||
switch (action.type) {
|
||||
case actionTypes.SET_ARTICLE:
|
||||
return { ...state, articles: action.updatedList, currentArticle: action.article, hasError: typeof action.article === undefined };
|
||||
return { ...state, articles: action.updatedList, currentArticle: action.article, hasError: typeof action.article === undefined, isLoading: false };
|
||||
case actionTypes.GET_ARTICLE:
|
||||
return { ...state, isLoading: true };
|
||||
case actionTypes.GET_ARTICLE_SUCCESS:
|
||||
return { ...state, isLoading: false, currentArticle: action.payload };
|
||||
case actionTypes.GET_ARTICLE_FAILURE:
|
||||
return { ...state, hasError: true, isLoading: false };
|
||||
return { ...state, hasError: false, isLoading: true };
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user