Merge remote-tracking branch 'origin/main'

# Conflicts:
#	src/App.tsx
#	src/lib/api.ts
This commit is contained in:
SR07 2025-06-09 18:52:45 +09:00
commit ae2a17ca5c
10 changed files with 48 additions and 15 deletions

5
.env.example Normal file
View File

@ -0,0 +1,5 @@
# Rename this file to .env and set the API base URL for your environment
# Example:
# VITE_API_BASE_URL=http://localhost:8000
VITE_API_BASE_URL=https://api.example.com

View File

@ -16,8 +16,6 @@ import Dashboard from './pages/Dashboard'
import MePage from './pages/MePage'
import CharacterEditPage from './pages/CharacterEditPage'
import GuidePage from './pages/Guide'
import FriendListPage from './pages/FriendListPage'
import FriendRequestsPage from './pages/FriendRequestsPage'
const darkTheme = createTheme({
palette: {
@ -48,10 +46,6 @@ function App() {
<Route path="/characters/:id/edit" element={<CharacterEditPage />} />
<Route path="/homeworks/:id/edit" element={<HomeworkEditPage />} />
<Route path="/guide" element={<GuidePage />} />
<Route path="/friends" element={<FriendListPage />} />
<Route path="/friends/requests" element={<FriendRequestsPage />} />
{/*<Route path="/friends/:friendId/characters" element={<FriendCharacterPage />} />*/}
{/*<Route path="/friends/:friendId/characters/:characterId/homeworks" element={<FriendHomeworkPage />} />*/}
</Routes>
</Layout>
</Router>

View File

@ -19,6 +19,7 @@ export default function Layout({ children }: { children: React.ReactNode }) {
const [anchorElCharacter, setAnchorElCharacter] = useState<null | HTMLElement>(null)
const [anchorElHomework, setAnchorElHomework] = useState<null | HTMLElement>(null)
const [anchorElFriend, setAnchorElFriend] = useState<null | HTMLElement>(null)
const [anchorElUser, setAnchorElUser] = useState<null | HTMLElement>(null)
const handleMenuOpen = (
@ -71,6 +72,16 @@ export default function Layout({ children }: { children: React.ReactNode }) {
<MenuItem component={Link} to="/homeworks" onClick={handleMenuClose(setAnchorElHomework)}> </MenuItem>
</Menu>
<Button color="inherit" onClick={handleMenuOpen(setAnchorElFriend)}></Button>
<Menu
anchorEl={anchorElFriend}
open={Boolean(anchorElFriend)}
onClose={handleMenuClose(setAnchorElFriend)}
>
<MenuItem component={Link} to="/friends" onClick={handleMenuClose(setAnchorElFriend)}></MenuItem>
<MenuItem component={Link} to="/friends/requests" onClick={handleMenuClose(setAnchorElFriend)}></MenuItem>
</Menu>
<IconButton color="inherit" onClick={handleUserMenuOpen} size="large">
<AccountCircle />
</IconButton>

View File

View File

@ -1,8 +1,8 @@
import axios from 'axios'
const api = axios.create({
// baseURL: 'https://api.biryu2000.kr',
baseURL: 'http://localhost:8000',
baseURL: 'https://api.biryu2000.kr',
// baseURL: 'http://localhost:8000',
})
// 요청 시 토큰 자동 추가

View File

@ -1,6 +1,5 @@
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import './index.css'
import App from './App.tsx'
// ✅ 추가: AuthProvider import

View File

@ -37,11 +37,11 @@ export default function CharacterEditPage() {
const handleUpdate = async () => {
try {
await api.put(`/characters/${id}`, {
name,
server,
power: Number(combatPower)
})
await api.put(`/characters/${id}`, {
name,
server,
combat_power: Number(combatPower)
})
navigate('/characters')
} catch {
setError('캐릭터 수정에 실패했습니다.')

12
src/pages/FriendList.tsx Normal file
View File

@ -0,0 +1,12 @@
import { Box, Typography } from '@mui/material'
export default function FriendList() {
return (
<Box sx={{ p: 4 }}>
<Typography variant="h5" gutterBottom>
</Typography>
<Typography> ...</Typography>
</Box>
)
}

View File

@ -0,0 +1,12 @@
import { Box, Typography } from '@mui/material'
export default function FriendRequests() {
return (
<Box sx={{ p: 4 }}>
<Typography variant="h5" gutterBottom>
</Typography>
<Typography> ...</Typography>
</Box>
)
}

View File

@ -20,7 +20,7 @@ export default function Login() {
password,
})
const { access_token, token_type } = res.data
const { access_token } = res.data
console.log('로그인 성공:', access_token)
login(access_token) // ✅ 전역 상태 + localStorage 동시 반영