upd: scroll
This commit is contained in:
@@ -31,13 +31,11 @@ export default function ListAnnouncement() {
|
||||
setLoading(true)
|
||||
const response = await funGetAllAnnouncement('?search=' + searchQuery + '&page=' + isPage)
|
||||
if (response.success) {
|
||||
// if (response.data.length > 0) {
|
||||
if (isPage == 1) {
|
||||
setIsData(response?.data)
|
||||
} else {
|
||||
setIsData([...isData, ...response?.data])
|
||||
}
|
||||
// }
|
||||
} else {
|
||||
toast.error(response.message);
|
||||
}
|
||||
@@ -79,7 +77,6 @@ export default function ListAnnouncement() {
|
||||
const scrollTop = containerRef.current.scrollTop;
|
||||
const containerHeight = containerRef.current.clientHeight;
|
||||
const scrollHeight = containerRef.current.scrollHeight;
|
||||
|
||||
if (scrollTop + containerHeight >= scrollHeight) {
|
||||
setPage(isPage + 1)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user