-
Notifications
You must be signed in to change notification settings - Fork 3
AJAX Documentation
Monica Bui edited this page Apr 13, 2021
·
4 revisions
We make AJAX calls to our backend for any CRUD operations that are needed to support this application. We use the Axios library (fetch wrapper) to make the API calls to return data from the backend that we can manipulate in the frontend and send back to save to our database.
The ApiUtils.js file is the main file that holds all our AJAX calls with some other calls sprinkled throughout our application if they are only used for one specific use case. The functions in this file is called throughout our app so that we can reuse these calls and save them all in one centralized location.
From top to bottom in the file,
- Get User By ID
- Get the current user
- Check if Author B is following Author A
- Check if a local author is following a remote author
- Send friend/follow request by B to A
- Get all followers given user ID
- Unfollow user A by B
- Get Inbox Posts
- Get all friends for given author ID
- Get a specific author post
- Delete a post
- Get all local and remote authors
- Like a comment
- Like a post
- Get comments
- Create a comment
- Get liked by given author ID
- Get likes for post
- Get likes for comment
In MyFeed.js,
In LoginPage.js