Skip to content

Commit

Permalink
sdp-tech#559 fix : search initialize
Browse files Browse the repository at this point in the history
  • Loading branch information
youngsikkk committed Nov 17, 2023
1 parent 77617df commit cbba1ce
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/components/mypick/mycuration/MyCuration.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ const MyCuration = (props) => {
const pageMyCuration = async () => {

setLoading(true);
setSearch(queryString.search);

const response = await request.get("/mypage/my_liked_curation/", {
page: queryString.page,
Expand Down
1 change: 1 addition & 0 deletions src/components/mypick/myplace/Myplace.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ const Myplace = () => {
const pageMyplace = async () => {

setLoading(true);
setSearch(queryString.search);
let params = new URLSearchParams();
for (const category of checkedList) params.append('filter', category);
const response = await request.get(`/mypage/myplace_search/?${params.toString()}`, {
Expand Down
6 changes: 3 additions & 3 deletions src/components/mypick/mystory/Mystory.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ const Mystory = () => {

setLoading(true);
let params = new URLSearchParams();

setSearch(queryString.search);
for (const category of checkedList) params.append('filter', category);

const response = await request.get(`/mypage/mypick_story/?${params.toString()}`, {
Expand All @@ -196,15 +196,15 @@ const Mystory = () => {

useEffect(() => {
if (search || checkedList) setPage(1);
}, [checkedList, search, queryString.page]);
}, [checkedList, search]);
useEffect(() => {
const params = {
page: page,
me: nickname
};
if (search) params.search = search;
if (checkedList) params.checkedList = checkedList
if ((page===1 && search||page===1 && checkedList)||page !== 1) {
if ((page===1 && search)||(page===1 && checkedList)||page !== 1) {
setSearchParams(params);
setPageOneFlag(true);
} else if (page === 1 && pageOneFlag) {
Expand Down

0 comments on commit cbba1ce

Please sign in to comment.