feature/improved-article-content-loading #179
@ -12,15 +12,27 @@ function useArticleViewModel(
|
|||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
|
|
||||||
const getArticle = useCallback(
|
const getArticle = useCallback(
|
||||||
(articleID: string) => {
|
(
|
||||||
|
articleID: string,
|
||||||
|
getArticleUseCase: GetArticleUseCase,
|
||||||
|
fetchArticleUseCase: FetchArticleUseCase
|
||||||
|
) => {
|
||||||
getArticleUseCase.call(articleID).catch((_) => fetchArticleUseCase.call(articleID));
|
getArticleUseCase.call(articleID).catch((_) => fetchArticleUseCase.call(articleID));
|
||||||
},
|
},
|
||||||
[id]
|
[]
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(
|
||||||
getArticle(id ?? '');
|
() => {
|
||||||
}, [id]);
|
getArticle(id ?? '', getArticleUseCase, fetchArticleUseCase);
|
||||||
|
},
|
||||||
|
[
|
||||||
|
id,
|
||||||
|
getArticle,
|
||||||
|
getArticleUseCase,
|
||||||
|
fetchArticleUseCase
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
article: store.currentArticle,
|
article: store.currentArticle,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user