크레딧기능 추가

This commit is contained in:
skkim committed 2026-04-28 14:32:55 +09:00
1 parent 044fd21b2d
commit bdd52ed992
12 files changed
+153 -25

No files matched your search

+14
View File
@@ -28,6 +28,7 @@ import {
TokenExpiredErrorResponse,
YTAutoSeoRequest,
YTAutoSeoResponse,
UserCreditsResponse,
} from '../types/api';
export const API_URL = import.meta.env.VITE_API_URL || 'http://40.82.133.44';
@@ -651,6 +652,19 @@ export async function getUserMe(): Promise<UserMeResponse> {
return response.json();
}
// 사용자 크레딧 조회
export async function getUserCredits(): Promise<UserCreditsResponse> {
const response = await authenticatedFetch(`${API_URL}/user/auth/me/credits`, {
method: 'GET',
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return response.json();
}
// 로그인 여부 확인
export function isLoggedIn(): boolean {
return !!getAccessToken();