Files
a301_client/src/api/auth.js
tolelom 4e3a01428a
Some checks failed
Client CI/CD / test (push) Waiting to run
Client CI/CD / deploy (push) Has been cancelled
fix: SSAFY OAuth 로그인 수정 및 API 클라이언트 안정성 개선 (8건)
- SSAFY OAuth state 파라미터 전달 추가 (로그인 불능 해결)
- POST/PUT/DELETE 5xx 및 네트워크 에러 재시도 방지 (멱등 요청만 재시도)
- UserAdmin 페이지네이션 추가 (offset/limit)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 23:26:40 +09:00

41 lines
1.1 KiB
JavaScript

import { apiFetch } from './client';
export async function login(username, password) {
return apiFetch('/api/auth/login', {
method: 'POST',
body: JSON.stringify({ username, password }),
});
}
export async function register(username, password) {
return apiFetch('/api/auth/register', {
method: 'POST',
body: JSON.stringify({ username, password }),
});
}
export async function logout() {
return apiFetch('/api/auth/logout', { method: 'POST' });
}
export async function getSSAFYLoginURL() {
return apiFetch('/api/auth/ssafy/login');
}
export async function ssafyCallback(code, state) {
return apiFetch('/api/auth/ssafy/callback', {
method: 'POST',
body: JSON.stringify({ code, state }),
});
}
// 토큰을 리프레시하고 새 access token을 반환 (동시 호출 방지 포함)
export { tryRefresh as refreshToken } from './client';
// 게임 런처용 일회용 티켓 발급 (JWT를 URL에 노출하지 않기 위해 사용)
export async function createLaunchTicket() {
const data = await apiFetch('/api/auth/launch-ticket', { method: 'POST' });
return data.ticket;
}