Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions front/src/pages/mainPages/AllThemePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,27 @@ function AllThemePage() {
sort,
);

const resethandler = () => {
setPosts([]);
setLastData('');
target.current.style.display = 'flex';
};

const sortHandler = sorted => {
console.log(sorted);
if (sort !== sorted) {
setSort(sorted);
}
if (posts.length !== 0) {
setPosts([]);
}
setLastData('');
target.current.style.display = 'flex';
resethandler();
// if (posts.length !== 0) {
// }
};

useEffect(() => {
hasNext(true);
}, [sort, search]);

useEffect(() => {
sortHandler(sort);
resethandler();
}, [search]);

useEffect(() => {
Expand Down
15 changes: 8 additions & 7 deletions front/src/pages/mainPages/RestaurantPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,25 @@ function RestaurantPage() {
sort,
);

const resethandler = () => {
setPosts([]);
setLastData('');
target.current.style.display = 'flex';
};

const sortHandler = sorted => {
console.log(sorted);
if (sort !== sorted) {
setSort(sorted);
}
if (posts.length !== 0) {
setPosts([]);
}
setLastData('');
target.current.style.display = 'flex';
resethandler();
};

useEffect(() => {
hasNext(true);
}, [sort, search]);

useEffect(() => {
sortHandler(sort);
resethandler();
}, [search]);

useEffect(() => {
Expand Down
15 changes: 8 additions & 7 deletions front/src/pages/mainPages/SpotPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,25 @@ function SpotPage() {
sort,
);

const resethandler = () => {
setPosts([]);
setLastData('');
target.current.style.display = 'flex';
};

const sortHandler = sorted => {
console.log(sorted);
if (sort !== sorted) {
setSort(sorted);
}
if (posts.length !== 0) {
setPosts([]);
}
setLastData('');
target.current.style.display = 'flex';
resethandler();
};

useEffect(() => {
hasNext(true);
}, [sort, search]);

useEffect(() => {
sortHandler(sort);
resethandler();
}, [search]);

useEffect(() => {
Expand Down
15 changes: 8 additions & 7 deletions front/src/pages/mainPages/StayPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,25 @@ function StayPage() {
sort,
);

const resethandler = () => {
setPosts([]);
setLastData('');
target.current.style.display = 'flex';
};

const sortHandler = sorted => {
console.log(sorted);
if (sort !== sorted) {
setSort(sorted);
}
if (posts.length !== 0) {
setPosts([]);
}
setLastData('');
target.current.style.display = 'flex';
resethandler();
};

useEffect(() => {
hasNext(true);
}, [sort, search]);

useEffect(() => {
sortHandler(sort);
resethandler();
}, [search]);

useEffect(() => {
Expand Down