Updated view model for article

This commit is contained in:
Daniel Weissmall 2022-11-13 01:16:11 +03:00
parent e20831fbfc
commit d755be1f95

View File

@ -11,17 +11,16 @@ function useArticleViewModel(
) {
const { id } = useParams();
// const getArticle = useCallback(
// () => {
// getArticleUseCase.call(id ?? '').catch((_) => fetchArticleUseCase.call(id ?? ''));
// console.log(id);
// },
// [id]
// );
const getArticle = useCallback(
(articleID: string) => {
getArticleUseCase.call(articleID).catch((_) => fetchArticleUseCase.call(articleID));
},
[id]
);
useEffect(() => {
getArticleUseCase.call(id ?? '').catch((_) => fetchArticleUseCase.call(id ?? ''));
}, []);
getArticle(id ?? '');
}, [id]);
return {
article: store.currentArticle,