Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!response.ok) { | ||
| throw new Error('تعذّر تحديث الحجز.'); | ||
| } | ||
|
|
||
| const data = (await response.json()) as { booking?: Booking }; |
There was a problem hiding this comment.
Assume booking PATCH always returns JSON body
The update handler unconditionally parses the PATCH response with response.json() after checking only response.ok. Many REST endpoints legitimately respond 204 No Content for a successful update, in which case response.json() throws and the UI treats the update as a failure even though the server accepted it. Consider skipping JSON parsing when the status is 204 or when no body is present before showing an error or updating local state.
Useful? React with 👍 / 👎.
Summary
Testing
https://chatgpt.com/codex/tasks/task_b_690262c3f4548328bee15e7c6ad42a7e