Merge pull request #12 from nightbug-xx/31gcf4-codex/친구정보-출력-문제-수정

Add public visibility toggles
This commit is contained in:
nightbug-xx 2025-06-11 10:28:10 +09:00 committed by GitHub
commit dc1c120837
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 6 deletions

View File

@ -44,8 +44,8 @@ export default function CharacterEditPage() {
await api.put(`/characters/${id}`, {
name,
server,
combat_power: Number(combatPower),
is_public: isPublic
power: Number(combatPower),
is_public: isPublic,
})
navigate('/characters')
} catch {

View File

@ -35,11 +35,11 @@ export default function HomeworkEditPage() {
const handleUpdate = async () => {
try {
await api.put(`/homeworks/${id}`, {
name: title, // ✅ title → name
title,
description,
repeat_type: resetType, // ✅ reset_type → repeat_type
repeat_count: Number(clearCount), // ✅ clear_count → repeat_count
is_public: isPublic
reset_type: resetType,
clear_count: Number(clearCount),
is_public: isPublic,
})
navigate('/homeworks')
} catch {

View File

@ -17,6 +17,7 @@ export default function RegisterHomework() {
const [description, setDescription] = useState('')
const [resetType, setResetType] = useState('')
const [clearCount, setClearCount] = useState(0)
const [resetTime, setResetTime] = useState('')
const [isPublic, setIsPublic] = useState(false)
const [error, setError] = useState('')
const navigate = useNavigate()
@ -28,6 +29,7 @@ export default function RegisterHomework() {
title,
description,
reset_type: resetType,
reset_time: resetTime,
clear_count: clearCount,
is_public: isPublic,
})
@ -69,6 +71,14 @@ export default function RegisterHomework() {
<MenuItem value="weekly"></MenuItem>
<MenuItem value="monthly"></MenuItem>
</TextField>
<TextField
fullWidth
type="time"
label="초기화 시간"
margin="normal"
value={resetTime}
onChange={(e) => setResetTime(e.target.value)}
/>
<TextField
fullWidth
type="number"