Fix uncategorize quiz — omit category_id param when null
Previously sent ?category_id= (empty string) which FastAPI rejects with 422 validation error when parsing as int. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
a31388ed17
commit
422fb1c14f
1 changed files with 2 additions and 1 deletions
|
|
@ -229,7 +229,8 @@ function QuizCard({ quiz, isModerator, categories, onDelete, onCategoryChange })
|
|||
|
||||
const assignCategory = async (catId) => {
|
||||
try {
|
||||
await api.patch(`/categories/quizzes/${quiz.id}`, null, { params: { category_id: catId ?? '' } })
|
||||
const params = catId == null ? {} : { category_id: catId }
|
||||
await api.patch(`/categories/quizzes/${quiz.id}`, null, { params })
|
||||
onCategoryChange(quiz.id, catId)
|
||||
} catch { }
|
||||
setShowCatMenu(false)
|
||||
|
|
|
|||
Loading…
Reference in a new issue