File tree Expand file tree Collapse file tree 5 files changed +9
-8
lines changed
Expand file tree Collapse file tree 5 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import { Global } from '@emotion/react';
77import Header from '~/components/Header' ;
88import Styled , { bottomSheetOverrides } from './ProfilePage.styles' ;
99import Layout from '~/components/Layout' ;
10- import { useUserByUserCodeV2 } from '@boolti/api' ;
10+ import { useUserByUserCodeV2 , useYoutubeVideoDuration } from '@boolti/api' ;
1111import {
1212 formatDateTimeWithWeekday ,
1313 formatDateWithWeekday ,
@@ -18,7 +18,6 @@ import {
1818import { Meta } from '~/components/Meta' ;
1919import { PROFILE_URL } from '~/constants/url' ;
2020import { EXTERNAL_URL } from '~/constants/external' ;
21- import { useYoutubeVideoDuration } from '~/hooks/useYoutubeVideoDuration' ;
2221
2322interface VideoCardProps {
2423 videoUrl : string ;
Original file line number Diff line number Diff line change @@ -3,9 +3,8 @@ import Styled from './ProfileVideosPage.styles';
33import { BooltiIcon } from '@boolti/icon' ;
44import Header from '~/components/Header' ;
55import Layout from '~/components/Layout' ;
6- import { useUserVideos } from '@boolti/api' ;
6+ import { useUserVideos , useYoutubeVideoDuration } from '@boolti/api' ;
77import { getYoutubeVideoId , getYoutubeThumbnailUrl , formatYoutubeDuration } from '~/utils' ;
8- import { useYoutubeVideoDuration } from '~/hooks/useYoutubeVideoDuration' ;
98
109interface VideoItemProps {
1110 videoUrl : string ;
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ import useAdminSalesTicketList from './useAdminSalesTicketList';
4848import useAdminReservationSummaryV2 from './useAdminReservationSummaryV2' ;
4949import usePopup from './usePopup' ;
5050import useSuperAdminShowSettlementStatement from './useSuperAdminShowSettlementStatement' ;
51+ import useYoutubeVideoDuration from './useYoutubeVideoDuration' ;
5152
5253export {
5354 useCastTeamList ,
@@ -100,4 +101,5 @@ export {
100101 useSuperAdminInvitationCodeList ,
101102 usePopup ,
102103 useSuperAdminShowSettlementStatement ,
104+ useYoutubeVideoDuration ,
103105} ;
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ export interface YouTubeVideoData {
1616 duration : string | null ;
1717}
1818
19- export const useYoutubeVideoDuration = (
19+ const useYoutubeVideoDuration = (
2020 videoId : string | null ,
2121) : UseQueryResult < YouTubeVideoData , Error > => {
2222 return useQuery ( {
@@ -26,7 +26,6 @@ export const useYoutubeVideoDuration = (
2626
2727 const apiKey = import . meta. env . VITE_YOUTUBE_API_KEY ;
2828 if ( ! apiKey ) {
29- console . warn ( 'YouTube API key is not configured' ) ;
3029 return { title : null , duration : null } ;
3130 }
3231
@@ -45,12 +44,13 @@ export const useYoutubeVideoDuration = (
4544 duration : data . items ?. [ 0 ] ?. contentDetails ?. duration ?? null ,
4645 } ;
4746 } catch ( error ) {
48- console . error ( 'Error fetching YouTube video data:' , error ) ;
4947 return { title : null , duration : null } ;
5048 }
5149 } ,
5250 enabled : ! ! videoId ,
53- staleTime : 1000 * 60 * 60 * 24 , // 24시간 캐싱
51+ staleTime : 1000 * 60 * 60 * 24 ,
5452 retry : 1 ,
5553 } ) ;
5654} ;
55+
56+ export default useYoutubeVideoDuration ;
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ interface ImportMetaEnv {
44 readonly VITE_KAKAO_REST_API_KEY : string ;
55 readonly VITE_BASE_API_URL : string ;
66 readonly VITE_IS_SUPER_ADMIN : string ;
7+ readonly VITE_YOUTUBE_API_KEY : string ;
78}
89
910interface ImportMeta {
You can’t perform that action at this time.
0 commit comments