File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ const Main = () => {
92
92
} , [ location ] ) ;
93
93
94
94
// 키워드 추천 게시글 api
95
- const fetchPosts = async ( { pageParam = 0 } ) => {
95
+ const fetchPosts = async ( pageParam = 0 ) => {
96
96
try {
97
97
const response = await apiInstance . post ( `filter?page=${ pageParam } &size=4` , {
98
98
height : user . height ,
@@ -151,12 +151,13 @@ const Main = () => {
151
151
useEffect ( ( ) => {
152
152
setPageParam ( 0 ) ;
153
153
// setFilteredPosts([]);
154
+ fetchPosts ( pageParam ) ;
154
155
} , [ selectedStyleTags , inputHeight , inputWeight ] ) ;
155
156
156
157
// 초기값 -1, pageParam이 0 이상의 값을 가질 때까지 실제 게시물 데이터를 요청하지 않음
157
158
useEffect ( ( ) => {
158
159
if ( pageParam === - 1 ) return ;
159
- fetchPosts ( { pageParam } ) ;
160
+ fetchPosts ( pageParam ) ;
160
161
} , [ pageParam ] ) ;
161
162
162
163
useEffect ( ( ) => {
@@ -214,8 +215,8 @@ const Main = () => {
214
215
// 전체 키워드 버튼 클릭
215
216
const handleAllTag = ( ) => {
216
217
setSelectedStyleTags ( [ ] ) ; // 모든 선택된 태그 해제
217
- setPageParam ( 0 ) ;
218
218
setFilteredPosts ( [ ] ) ;
219
+ setPageParam ( 0 ) ;
219
220
} ;
220
221
221
222
const handleBodyClick = ( ) => {
You can’t perform that action at this time.
0 commit comments