-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
refactorSomething needed some clean up or could be improvedSomething needed some clean up or could be improvedsecurityChange improves or fixes one or more security holesChange improves or fixes one or more security holes
Milestone
Description
Currently, the ApiService uses the native fetch() API when communicating w/ the server. We should update it to use the Axios library for several reasons -
- Axios has a simpler API for making requests
- We can set the baseURL during APIService's setup so that each subsequent
.get()or.post()is cleaner - Axios has some built in security features
- Axios can deal directly w/
Promises, whereas fetch requires some tinkering
This ticket will involve a few steps -
- Adding Axios to project devDependencies
- Run
npm ito make sure thepackage-lock.jsonstays up to date - Use the Axios API docs to transform the
ApiServiceclass from usingfetch()to using Axios - This change will require that all the unit tests for ApiService are updated as well (or temp commented out until another story is created to update them); either step 1 or 2 below must be completed (but not both)
- Comment out the tests in ApiService.test.tsx except for a
expect(true).toBeTruthy()(since config does not allow empty test files) - Update the test files in ApiService.test.tsx to use a mocked Axios
- Comment out the tests in ApiService.test.tsx except for a
Notes
- Axios API Docs - https://axios-http.com/docs/api_intro
- Fetch API Docs - https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
- also, a guide on using fetch - https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch
Metadata
Metadata
Assignees
Labels
refactorSomething needed some clean up or could be improvedSomething needed some clean up or could be improvedsecurityChange improves or fixes one or more security holesChange improves or fixes one or more security holes
Projects
Status
Todo