@@ -78,9 +78,7 @@ const PostGallery = () => {
7878
7979 const [ isLoading , setIsLoading ] = useState ( true ) ;
8080 const [ viewType , setViewType ] = useState < "grid" | "card" > ( "grid" ) ;
81- const [ sortType , setSortType ] = useState < "POPULAR" | "LIKE_COUNT" | "LATEST" > (
82- "POPULAR"
83- ) ;
81+ const [ sortType , setSortType ] = useState < "POPULAR" | "LIKE_COUNT" | "LATEST" > ( "POPULAR" ) ;
8482
8583 const skipRef = useRef ( false ) ;
8684 const isAuthenticated = useContext ( AuthContext ) ;
@@ -132,11 +130,10 @@ const PostGallery = () => {
132130 // 최초 로드
133131 ( async ( ) => {
134132 setIsLoading ( true ) ;
135- const token = Cookies . get ( "accessToken" ) ;
136133
137- const exploreData = await fetchExploreScripts ( token , sortType ) ;
138- const longData = await getLongWorks ( 0 , token , sortType ) ;
139- const shortData = await getShortWorks ( 0 , token , sortType ) ;
134+ const exploreData = await fetchExploreScripts ( sortType ) ;
135+ const longData = await getLongWorks ( 0 , sortType ) ;
136+ const shortData = await getShortWorks ( 0 , sortType ) ;
140137
141138 setExplore ( exploreData ) ;
142139 setLongPlays ( longData ) ;
@@ -170,15 +167,14 @@ const PostGallery = () => {
170167
171168 ( async ( ) => {
172169 setIsLoading ( true ) ;
173- const token = Cookies . get ( "accessToken" ) ;
174170
175171 // explore 갱신
176- const exploreData = await fetchExploreScripts ( token , sortType ) ;
172+ const exploreData = await fetchExploreScripts ( sortType ) ;
177173 setExplore ( exploreData ) ;
178174
179175 // 장편/단편은 현재 페이지 기준으로 다시 가져오게 함
180- const longData = await getLongWorks ( 0 , token , sortType ) ;
181- const shortData = await getShortWorks ( 0 , token , sortType ) ;
176+ const longData = await getLongWorks ( 0 , sortType ) ;
177+ const shortData = await getShortWorks ( 0 , sortType ) ;
182178
183179 setLongPlays ( longData ) ;
184180 setShortPlays ( shortData ) ;
@@ -208,11 +204,10 @@ const PostGallery = () => {
208204 // ----------------------------
209205 useEffect ( ( ) => {
210206 if ( ! inView || isLoading ) return ;
211- const token = Cookies . get ( "accessToken" ) ;
212207
213208 ( async ( ) => {
214209 if ( activeCategory === "장편" && hasMoreLongPlays ) {
215- const data = await getLongWorks ( longPlayPage , token , sortType ) ;
210+ const data = await getLongWorks ( longPlayPage , sortType ) ;
216211 if ( data . length === 0 ) {
217212 setHasMoreLongPlays ( false ) ;
218213 return ;
@@ -222,7 +217,7 @@ const PostGallery = () => {
222217 }
223218
224219 if ( activeCategory === "단편" && hasMoreShortPlays ) {
225- const data = await getShortWorks ( shortPlayPage , token , sortType ) ;
220+ const data = await getShortWorks ( shortPlayPage , sortType ) ;
226221 if ( data . length === 0 ) {
227222 setHasMoreShortPlays ( false ) ;
228223 return ;
@@ -293,9 +288,7 @@ const PostGallery = () => {
293288 return (
294289 < div className = "flex flex-col m-auto list-wrap-wrap py-[72px] " >
295290 { /*------ 작품 둘러보기 ------*/ }
296- < p className = "sm:h5-bold p-medium-bold mb-[30px] pl-[25px] sm:pl-0" >
297- 작품 둘러보기
298- </ p >
291+ < p className = "sm:h5-bold p-medium-bold mb-[30px] pl-[25px] sm:pl-0" > 작품 둘러보기</ p >
299292
300293 { /*------ 배너 ------*/ }
301294 < InfiniteBanner />
@@ -306,9 +299,7 @@ const PostGallery = () => {
306299 activeStage = { activeStage }
307300 setActiveStage = { ( value ) => handleChangeCategory ( value , "stage" ) }
308301 activeStoryLength = { activeCategory }
309- setActiveStoryLength = { ( value ) =>
310- handleChangeCategory ( value , "category" )
311- }
302+ setActiveStoryLength = { ( value ) => handleChangeCategory ( value , "category" ) }
312303 viewType = { viewType }
313304 setViewType = { setViewType }
314305 isSorted = { true }
@@ -325,10 +316,7 @@ const PostGallery = () => {
325316 style = { { gridTemplateColumns : `repeat(${ colNum } , minmax(0, 1fr))` } }
326317 >
327318 { Array . from ( { length : postNum } ) . map ( ( _ , idx ) => (
328- < div
329- key = { idx }
330- className = "animate-pulse rounded-2xl h-[189px] sm:h-[293px] "
331- >
319+ < div key = { idx } className = "animate-pulse rounded-2xl h-[189px] sm:h-[293px] " >
332320 { /* 썸네일 영역 */ }
333321 < div className = "h-[120px] sm:h-[197px] w-full rounded-2xl bg-gray-200" />
334322
@@ -395,15 +383,10 @@ const PostGallery = () => {
395383 onToggleLike = { handleLikeLong }
396384 />
397385
398- < ScrollObserver
399- inViewRef = { inViewRef }
400- id = { `long-${ sortType } -${ longPlayPage } ` }
401- />
386+ < ScrollObserver inViewRef = { inViewRef } id = { `long-${ sortType } -${ longPlayPage } ` } />
402387 </ >
403388 ) : (
404- < p className = "m-auto w-fit p-large-bold mt-[80px]" >
405- 등록된 작품이 없습니다.
406- </ p >
389+ < p className = "m-auto w-fit p-large-bold mt-[80px]" > 등록된 작품이 없습니다.</ p >
407390 ) }
408391 </ div >
409392 </ section >
@@ -431,15 +414,10 @@ const PostGallery = () => {
431414 onToggleLike = { handleLikeShort }
432415 />
433416
434- < ScrollObserver
435- inViewRef = { inViewRef }
436- id = { `short-${ sortType } -${ shortPlayPage } ` }
437- />
417+ < ScrollObserver inViewRef = { inViewRef } id = { `short-${ sortType } -${ shortPlayPage } ` } />
438418 </ >
439419 ) : (
440- < p className = "m-auto w-fit p-large-bold mt-[80px]" >
441- 등록된 작품이 없습니다.
442- </ p >
420+ < p className = "m-auto w-fit p-large-bold mt-[80px]" > 등록된 작품이 없습니다.</ p >
443421 ) }
444422 </ div >
445423 </ section >
0 commit comments