Download Facebook-Clone/frontend/util/session_api_util.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 990 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/Facebook-Clone/frontend/util/session_api_util.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@f5071caa249115f3b590492f1c8eb471e02aae4b/Facebook-Clone/frontend/util/session_api_util.js
-
curl -L -o session_api_util.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/Facebook-Clone/frontend/util/session_api_util.js
990 Bytes
| export const signup = (user) => ( | |
| $.ajax({ | |
| method: 'POST', | |
| url: 'api/users', | |
| data: {user} | |
| }) | |
| ); | |
| export const login = (user) => ( | |
| $.ajax({ | |
| method: 'POST', | |
| url: 'api/session', | |
| data: {user} | |
| }) | |
| ); | |
| export const demologin = () => ( | |
| $.ajax({ | |
| method: 'POST', | |
| url: 'api/session', | |
| data:{user:{email:"abhi@codeanand.com",password:"password"}}, | |
| }) | |
| ); | |
| export const logout = () => ( | |
| $.ajax({ | |
| method: 'DELETE', | |
| url: 'api/session', | |
| }) | |
| ); | |
| export const fetchUser = (id) => { | |
| return $.ajax({ | |
| method: 'GET', | |
| url: `api/users/${id}`, | |
| }); | |
| }; | |
| export const fetchAllUsers = () => { | |
| return $.ajax({ | |
| method: 'GET', | |
| url: `api/users`, | |
| }); | |
| }; | |
| export const updateUser = (formdata) => { | |
| return $.ajax({ | |
| method: 'PATCH', | |
| url: `api/users/_`, | |
| data: formdata, | |
| processData: false, | |
| contentType: false, | |
| }); | |
| }; | |
| export const searchUsers = (query) => { | |
| return $.ajax({ | |
| url: `/api/users/search`, | |
| data: { query } | |
| }); | |
| }; | |