feat: 게임 시작 버튼 추가 및 AuthContext 린트 에러 수정
All checks were successful
Client CI/CD / deploy (push) Successful in 10s

- DownloadSection에 a301:// 커스텀 URI로 게임 실행하는 버튼 추가
- AuthContext에서 createContext와 useAuth 훅을 별도 파일로 분리하여 react-refresh 린트 에러 해결

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-24 20:55:27 +09:00
parent e025fdfe87
commit 6998ffd6a3
9 changed files with 60 additions and 13 deletions

View File

@@ -1,6 +1,6 @@
import { useState, useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
import { useAuth } from '../context/AuthContext';
import { useAuth } from '../context/useAuth';
import { getDownloadInfo } from '../api/download';
import './DownloadSection.css';
@@ -23,6 +23,14 @@ export default function DownloadSection() {
}
};
const handleLaunch = () => {
if (!user) {
navigate('/login');
return;
}
window.location.href = 'a301://launch?token=' + user.token;
};
if (!ready) return null;
return (
@@ -37,6 +45,12 @@ export default function DownloadSection() {
<a href={info.url} download onClick={handleDownload} className="btn-download">
{user ? '다운로드' : '로그인 후 다운로드'}
</a>
<button onClick={handleLaunch} className="btn-launch">
게임 시작
</button>
<p className="launch-hint">
게임 시작이 되나요? 먼저 다운로드 launcher.exe install을 실행해주세요.
</p>
</>
) : (
<p className="download-preparing">런처 준비 중입니다. 잠시 다시 확인해주세요.</p>