- 게임 시작 전 토큰 리프레시 (만료 토큰 전달 방지) - 토큰 null 가드 (다른 탭 로그아웃 시 로그인 유도) - 토큰 URL 인코딩 (encodeURIComponent) - 런처 미설치 시 힌트 강조 표시 - 게임 시작 버튼 로딩 상태 + 더블 클릭 방지 - 다운로드 정보 실패 시 재시도 버튼 추가 - 비밀번호 강도 실시간 피드백 (약함/보통/강함) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -18,3 +18,25 @@ export async function logout() {
|
||||
return apiFetch('/api/auth/logout', { method: 'POST' });
|
||||
}
|
||||
|
||||
// 토큰을 리프레시하고 새 access token을 반환
|
||||
export async function refreshToken() {
|
||||
const rt = localStorage.getItem('refreshToken');
|
||||
if (!rt) throw new Error('no_refresh_token');
|
||||
|
||||
const res = await fetch(
|
||||
(import.meta.env.VITE_API_BASE_URL || '') + '/api/auth/refresh',
|
||||
{
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ refreshToken: rt }),
|
||||
}
|
||||
);
|
||||
|
||||
if (!res.ok) throw new Error('refresh_failed');
|
||||
|
||||
const data = await res.json();
|
||||
localStorage.setItem('token', data.token);
|
||||
localStorage.setItem('refreshToken', data.refreshToken);
|
||||
return data.token;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user