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