Download Facebook-Clone/frontend/util/posts_api_util.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 814 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/Facebook-Clone/frontend/util/posts_api_util.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@f5071caa249115f3b590492f1c8eb471e02aae4b/Facebook-Clone/frontend/util/posts_api_util.js
-
curl -L -o posts_api_util.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/Facebook-Clone/frontend/util/posts_api_util.js
814 Bytes
| export const createPost = formdata => | |
| $.ajax({ | |
| method: 'POST', | |
| url: 'api/posts', | |
| data: formdata, | |
| processData: false, | |
| contentType: false, | |
| }); | |
| export const updatePost = post => | |
| $.ajax({ | |
| method: 'PATCH', | |
| url: `api/posts/${post.id}`, | |
| data: { post } | |
| }); | |
| export const deletePost = id => | |
| $.ajax({ | |
| method: 'DELETE', | |
| url: `api/posts/${id}` | |
| }); | |
| export const fetchWallPosts = id => | |
| $.ajax({ | |
| method: 'GET', | |
| url: `api/users/${id}/wall` | |
| }); | |
| export const fetchNewsFeed = () => | |
| $.ajax({ | |
| method: 'GET', | |
| url: `api/users/feed` | |
| }); | |
| export const fetchPost = id => ( | |
| $.ajax({ | |
| method: 'GET', | |
| url: `api/posts/${id}` | |
| }) | |
| ); | |
| export const fetchAllPosts = () => ( | |
| $.ajax({ | |
| method: 'GET', | |
| url: `api/posts/` | |
| }) | |
| ); | |