Download Facebook-Clone/frontend/util/comment_api_util.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 708 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/Facebook-Clone/frontend/util/comment_api_util.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@f5071caa249115f3b590492f1c8eb471e02aae4b/Facebook-Clone/frontend/util/comment_api_util.js
-
curl -L -o comment_api_util.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/Facebook-Clone/frontend/util/comment_api_util.js
708 Bytes
| export const fetchComments = postId => ( | |
| $.ajax({ | |
| url: `/api/posts/${postId}/comments`, | |
| }) | |
| ); | |
| export const fetchComment = (postId, commentId) => ( | |
| $.ajax({ | |
| url: `/api/posts/${postId}/comments/${commentId}`, | |
| }) | |
| ); | |
| export const postComment = (postId, comment) => ( | |
| $.ajax({ | |
| url: `/api/posts/${postId}/comments`, | |
| method: "POST", | |
| data: { comment }, | |
| }) | |
| ); | |
| export const patchComment = (postId, comment) => ( | |
| $.ajax({ | |
| url: `/api/posts/${postId}/comments/${comment.id}`, | |
| method: "PATCH", | |
| data: { comment }, | |
| }) | |
| ); | |
| export const deleteComment = (postId, commentId) => ( | |
| $.ajax({ | |
| url: `/api/posts/${postId}/comments/${commentId}`, | |
| method: "DELETE", | |
| }) | |
| ); | |