-
Notifications
You must be signed in to change notification settings - Fork 153
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
Develop #48
base: main
Are you sure you want to change the base?
Develop #48
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.
Great job on your code! It's well-structured and organized. There are a few minor points for improvement, such as specifying the expected return type for functions, but they don't impact the functionality of your code. Keep up the good work! 👍
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
src/api/api.ts
Outdated
export const getUserByEmail = (email: string) => { | ||
return client.get('/users', { | ||
params: { | ||
email, | ||
} | ||
}) | ||
} |
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.
It's a good practice to specify the expected return type for each function. This will make your code more predictable and easier to debug. For example, you could specify that this function returns a Promise that resolves to an AxiosResponse.
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.
done
src/api/api.ts
Outdated
export const createUser = (email: string, name: string) => { | ||
return client.post('/users', { | ||
email, | ||
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.
Again, it's recommended to specify the expected return type for this function. This will help to prevent potential errors in the future.
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.
done
src/api/api.ts
Outdated
export const getPostsById = (userId: number) => { | ||
return client.get('/posts', { | ||
params: { | ||
userId, | ||
} | ||
}) | ||
} |
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 function name getPostsById suggests that it should return a single post by its id, but it seems to return multiple posts by user id. Consider renaming it to getPostsByUserId for better clarity.
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.
done
src/api/api.ts
Outdated
export const createPost = (title: string, body: string, userId: number) => { | ||
return client.post('/posts', { | ||
title, | ||
body, | ||
userId, | ||
}) | ||
} |
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.
Specify the expected return type for this function to improve code predictability and debuggability.
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.
done
src/api/api.ts
Outdated
export const updatePost = (title: string, body: string, postId: number, userId: number) => { | ||
return client.patch(`/posts/${postId}`, { | ||
title, | ||
body, | ||
userId, | ||
}) | ||
} |
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.
Specify the expected return type for this function to improve code predictability and debuggability.
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.
done
src/api/api.ts
Outdated
export const deletePost = (postId: number) => { | ||
return client.delete(`/posts/${postId}`) | ||
} |
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.
Specify the expected return type for this function to improve code predictability and debuggability.
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.
done
src/api/api.ts
Outdated
export const getCommentsByPostId = (postId: number) => { | ||
return client.get('/comments', { | ||
params: { | ||
postId, | ||
} | ||
}) | ||
} |
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.
Specify the expected return type for this function to improve code predictability and debuggability.
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.
done
src/api/api.ts
Outdated
export const createComment = (postId: number, name: string, body: string, email: string) => { | ||
return client.post('/comments', { | ||
postId, | ||
name, | ||
body, | ||
email, | ||
}) | ||
} |
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.
Specify the expected return type for this function to improve code predictability and debuggability.
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.
done
src/api/api.ts
Outdated
export const deleteComment = (commentId: number) => { | ||
return client.delete(`/comments/${commentId}`) | ||
} |
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.
Specify the expected return type for this function to improve code predictability and debuggability.
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.
done
…; changing api function names for better readability
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.
Great! 🔥
https://pavlo-petrashevskyi.github.io/vue_dynamic-list-of-posts/