fix pagination
This commit is contained in:
parent
40d8d21b3e
commit
59e7b48193
@ -21,7 +21,7 @@ const NewsList: React.FC<INewsListProps> = ({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getNews(activePage);
|
getNews(activePage);
|
||||||
}, []);
|
}, [activePage]);
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col gap-4">
|
<div className="flex flex-col gap-4">
|
||||||
<ul className="flex gap-[30px] flex-wrap mb-[96px]">
|
<ul className="flex gap-[30px] flex-wrap mb-[96px]">
|
||||||
@ -46,7 +46,7 @@ const NewsList: React.FC<INewsListProps> = ({
|
|||||||
next={news.next}
|
next={news.next}
|
||||||
count={news.count as number}
|
count={news.count as number}
|
||||||
current_count={news.results.length}
|
current_count={news.results.length}
|
||||||
limit={20}
|
limit={9}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -22,7 +22,7 @@ export const useNewsStore = create<useNewsStore>((set) => ({
|
|||||||
try {
|
try {
|
||||||
set({ isLoading: true });
|
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 });
|
set({ data: res.data });
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
|
Loading…
Reference in New Issue
Block a user