youtube 계정연결 기능 작업
This commit is contained in:
1 parent
cac825de19
commit
5c912e4bf8
11 files changed
+2918
-86
No files matched your search
@@ -18,6 +18,10 @@ import {
|
||||
KakaoCallbackResponse,
|
||||
TokenRefreshResponse,
|
||||
UserMeResponse,
|
||||
YouTubeConnectResponse,
|
||||
SocialAccountsResponse,
|
||||
SocialAccountResponse,
|
||||
SocialDisconnectResponse,
|
||||
} from '../types/api';
|
||||
|
||||
const API_URL = import.meta.env.VITE_API_URL || 'http://40.82.133.44';
|
||||
@@ -665,3 +669,59 @@ export async function autocomplete(request: AutocompleteRequest): Promise<Crawli
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================
|
||||
// Social OAuth API (YouTube, Instagram, Facebook)
|
||||
// ============================================
|
||||
|
||||
// YouTube 연결 URL 획득
|
||||
export async function getYouTubeConnectUrl(): Promise<YouTubeConnectResponse> {
|
||||
const response = await authenticatedFetch(`${API_URL}/social/oauth/youtube/connect`, {
|
||||
method: 'GET',
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
|
||||
return response.json();
|
||||
}
|
||||
|
||||
// 연결된 소셜 계정 목록 조회
|
||||
export async function getSocialAccounts(): Promise<SocialAccountsResponse> {
|
||||
const response = await authenticatedFetch(`${API_URL}/social/oauth/accounts`, {
|
||||
method: 'GET',
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
|
||||
return response.json();
|
||||
}
|
||||
|
||||
// 특정 플랫폼 계정 조회
|
||||
export async function getSocialAccountByPlatform(platform: 'youtube' | 'instagram' | 'facebook'): Promise<SocialAccountResponse> {
|
||||
const response = await authenticatedFetch(`${API_URL}/social/oauth/accounts/${platform}`, {
|
||||
method: 'GET',
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
|
||||
return response.json();
|
||||
}
|
||||
|
||||
// 소셜 계정 연결 해제
|
||||
export async function disconnectSocialAccount(platform: 'youtube' | 'instagram' | 'facebook'): Promise<SocialDisconnectResponse> {
|
||||
const response = await authenticatedFetch(`${API_URL}/social/oauth/${platform}/disconnect`, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
|
||||
return response.json();
|
||||
}
|
||||
Reference in new issue
Block a user