diff --git a/src/widgets/NewsList/NewsList.tsx b/src/widgets/NewsList/NewsList.tsx index a51a633..5b58d7c 100644 --- a/src/widgets/NewsList/NewsList.tsx +++ b/src/widgets/NewsList/NewsList.tsx @@ -21,7 +21,7 @@ const NewsList: React.FC = ({ useEffect(() => { getNews(activePage); - }, []); + }, [activePage]); return (
diff --git a/src/widgets/NewsList/newsStore.ts b/src/widgets/NewsList/newsStore.ts index c39828f..628f829 100644 --- a/src/widgets/NewsList/newsStore.ts +++ b/src/widgets/NewsList/newsStore.ts @@ -22,7 +22,7 @@ export const useNewsStore = create((set) => ({ try { set({ isLoading: true }); - const res = await apiInstance.get(`/news/`); + const res = await apiInstance.get(`/news/?limit=9&offset=${(page - 1) * 9}`); set({ data: res.data }); } catch (error: unknown) {