Skip to content

Commit 471f272

Browse files
authored
Merge pull request #351 from Nexters/fix/qa-2025-12-08
fix: youtube api 경로 변경
2 parents c566123 + 3feea31 commit 471f272

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

apps/profile/src/pages/ProfilePage/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Global } from '@emotion/react';
77
import Header from '~/components/Header';
88
import Styled, { bottomSheetOverrides } from './ProfilePage.styles';
99
import Layout from '~/components/Layout';
10-
import { useUserByUserCodeV2 } from '@boolti/api';
10+
import { useUserByUserCodeV2, useYoutubeVideoDuration } from '@boolti/api';
1111
import {
1212
formatDateTimeWithWeekday,
1313
formatDateWithWeekday,
@@ -18,7 +18,6 @@ import {
1818
import { Meta } from '~/components/Meta';
1919
import { PROFILE_URL } from '~/constants/url';
2020
import { EXTERNAL_URL } from '~/constants/external';
21-
import { useYoutubeVideoDuration } from '~/hooks/useYoutubeVideoDuration';
2221

2322
interface VideoCardProps {
2423
videoUrl: string;

apps/profile/src/pages/ProfileVideosPage/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ import Styled from './ProfileVideosPage.styles';
33
import { BooltiIcon } from '@boolti/icon';
44
import Header from '~/components/Header';
55
import Layout from '~/components/Layout';
6-
import { useUserVideos } from '@boolti/api';
6+
import { useUserVideos, useYoutubeVideoDuration } from '@boolti/api';
77
import { getYoutubeVideoId, getYoutubeThumbnailUrl, formatYoutubeDuration } from '~/utils';
8-
import { useYoutubeVideoDuration } from '~/hooks/useYoutubeVideoDuration';
98

109
interface VideoItemProps {
1110
videoUrl: string;

packages/api/src/queries/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import useAdminSalesTicketList from './useAdminSalesTicketList';
4848
import useAdminReservationSummaryV2 from './useAdminReservationSummaryV2';
4949
import usePopup from './usePopup';
5050
import useSuperAdminShowSettlementStatement from './useSuperAdminShowSettlementStatement';
51+
import useYoutubeVideoDuration from './useYoutubeVideoDuration';
5152

5253
export {
5354
useCastTeamList,
@@ -100,4 +101,5 @@ export {
100101
useSuperAdminInvitationCodeList,
101102
usePopup,
102103
useSuperAdminShowSettlementStatement,
104+
useYoutubeVideoDuration,
103105
};

apps/profile/src/hooks/useYoutubeVideoDuration.ts renamed to packages/api/src/queries/useYoutubeVideoDuration.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff 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;

packages/api/src/vite-env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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

910
interface ImportMeta {

0 commit comments

Comments
 (0)