Merge pull request #14 from nightbug-xx/n28iag-codex/친구정보-출력-문제-수정
Add friend dashboard page
This commit is contained in:
commit
ed53cfcc11
@ -50,7 +50,7 @@ function App() {
|
||||
<Route path="/homeworks/:id/edit" element={<HomeworkEditPage />} />
|
||||
<Route path="/guide" element={<GuidePage />} />
|
||||
<Route path="/friends" element={<FriendListPage />} />
|
||||
<Route path="/friends/:friendId/characters" element={<FriendCharacterDashboard />} />
|
||||
<Route path="/friends/:friend_id/characters" element={<FriendCharacterDashboard />} />
|
||||
<Route path="/friends/requests" element={<FriendRequestsPage />} />
|
||||
</Routes>
|
||||
</Layout>
|
||||
|
||||
@ -27,7 +27,7 @@ interface Homework {
|
||||
}
|
||||
|
||||
export default function FriendCharacterDashboard() {
|
||||
const { friendId } = useParams()
|
||||
const { friend_id } = useParams()
|
||||
const [characters, setCharacters] = useState<Character[]>([])
|
||||
const [homeworks, setHomeworks] = useState<Record<number, Homework[]>>({})
|
||||
const navigate = useNavigate()
|
||||
@ -35,13 +35,13 @@ export default function FriendCharacterDashboard() {
|
||||
useEffect(() => {
|
||||
const fetchData = async () => {
|
||||
try {
|
||||
const res = await api.get(`/friends/${friendId}/characters`)
|
||||
const res = await api.get(`/friends/${friend_id}/characters`)
|
||||
setCharacters(res.data)
|
||||
|
||||
const hwResults = await Promise.all(
|
||||
res.data.map((char: Character) =>
|
||||
api
|
||||
.get(`/friends/${friendId}/characters/${char.character_id}/homeworks`)
|
||||
.get(`/friends/${friend_id}/characters/${char.character_id}/homeworks`)
|
||||
.then(r => ({ id: char.character_id, data: r.data }))
|
||||
)
|
||||
)
|
||||
@ -55,7 +55,7 @@ export default function FriendCharacterDashboard() {
|
||||
}
|
||||
}
|
||||
fetchData()
|
||||
}, [friendId])
|
||||
}, [friend_id])
|
||||
|
||||
return (
|
||||
<Box sx={{ p: 4 }}>
|
||||
|
||||
@ -1,12 +0,0 @@
|
||||
import { Box, Typography } from '@mui/material'
|
||||
|
||||
export default function FriendList() {
|
||||
return (
|
||||
<Box sx={{ p: 4 }}>
|
||||
<Typography variant="h5" gutterBottom>
|
||||
친구 목록
|
||||
</Typography>
|
||||
<Typography>준비 중...</Typography>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
@ -1,12 +0,0 @@
|
||||
import { Box, Typography } from '@mui/material'
|
||||
|
||||
export default function FriendRequests() {
|
||||
return (
|
||||
<Box sx={{ p: 4 }}>
|
||||
<Typography variant="h5" gutterBottom>
|
||||
요청 관리
|
||||
</Typography>
|
||||
<Typography>준비 중...</Typography>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user