-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Solution #54
base: main
Are you sure you want to change the base?
Solution #54
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your code is well-structured and meets the task requirements effectively! 🎉 While there are some considerations regarding the Content-Type
headers, these are minor and do not impact the core functionality of your application. It's great to see your attention to detail in API interactions. Keep up the excellent work, and consider verifying the API requirements for content types to ensure optimal performance. Happy coding! 🚀
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
const response = await client.post('/comments', commentData, { | ||
headers: { | ||
'Content-Type': 'application/x-www-form-urlencoded' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Content-Type
header is set to application/x-www-form-urlencoded
. Ensure that this is the required format for your API. If the API expects JSON, you should use application/json
instead.
const response = await client.delete(`/comments/${commentId}`, { | ||
headers: { | ||
'Content-Type': 'application/x-www-form-urlencoded' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to the POST request, verify if the DELETE request requires the Content-Type
header to be application/x-www-form-urlencoded
. Typically, DELETE requests do not need a body, so this header might be unnecessary.
headers: { | ||
'Content-Type': 'application/x-www-form-urlencoded' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Content-Type
header is set to application/x-www-form-urlencoded
. Ensure this is the required format for your API. If the API expects JSON, you should use application/json
instead.
headers: { | ||
'Content-Type': 'application/x-www-form-urlencoded' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Content-Type
header is set to application/x-www-form-urlencoded
. Verify if this is necessary for PATCH requests. JSON is typically used for sending data in PATCH requests.
headers: { | ||
'Content-Type': 'application/x-www-form-urlencoded' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Content-Type
header is set to application/x-www-form-urlencoded
. DELETE requests usually do not require a body, so this header might be unnecessary. Verify the API requirements.
export const addUser = async (userData) => { | ||
const response = await client.post('/users', { | ||
name: userData.name, | ||
username: userData.name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The username
field is assigned the value of userData.name
. If this is intentional, ensure that name
and username
are supposed to be the same. Otherwise, consider using userData.username
.
headers: { | ||
'Content-Type': 'application/x-www-form-urlencoded' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Content-Type
header is set to application/x-www-form-urlencoded
. Ensure this is the required format for your API. If the API expects JSON, you should use application/json
instead.
headers: { | ||
'Content-Type': 'application/x-www-form-urlencoded' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Content-Type
header is set to application/x-www-form-urlencoded
. Verify if this is necessary for PATCH requests. JSON is typically used for sending data in PATCH requests.
headers: { | ||
'Content-Type': 'application/x-www-form-urlencoded' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Content-Type
header is set to application/x-www-form-urlencoded
. DELETE requests usually do not require a body, so this header might be unnecessary. Verify the API requirements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good Job 👍
let's improve your solution
Demo