Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Switch from fetch to axios #453

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
presleyp opened this issue Mar 16, 2022 · 1 comment · Fixed by #460
Closed

Switch from fetch to axios #453

presleyp opened this issue Mar 16, 2022 · 1 comment · Fixed by #460
Assignees
Labels
site Area: frontend dashboard
Milestone

Comments

@presleyp
Copy link
Contributor

As a developer, I want my API calling functions to contain as little boilerplate as possible so I can easily understand them and quickly mock them. I also want the ability to easily add logging of requests or responses.

Currently, we use fetch for our API calls. Axios would cut down on boilerplate:

  • config sets some info once and for all
  • no need to unpack the json
  • no need to check ok
  • adding interceptors is easier (can be used for logging)
  • adding timeouts is easier
    These and other benefits are discussed here.

I suggest we switch from fetch to axios in the api file. We can move the in-component SWR calls over as we move them to XState.

@greyscaled
Copy link
Contributor

greyscaled commented Mar 16, 2022

I'm in support of this change, I have used axios happily before.

It might be useful to us to only change 1 over first as an example, including how we plan to wire in testing around it with a mock return.

greyscaled added a commit that referenced this issue Mar 16, 2022
Summary:

Applies axios to login, logout and getApiKey

Impact:

POC of axios (#453) and testing axios

Additional details:

* add test:watch script
greyscaled added a commit that referenced this issue Mar 16, 2022
Summary:

Applies axios to login, logout and getApiKey

Impact:

POC of axios (#453) and testing axios

Additional details:

* add test:watch script

resolves: #453
greyscaled pushed a commit that referenced this issue Mar 16, 2022
Summary:

Applies axios to login, logout and getApiKey

Impact:

POC of axios (#453) and testing axios

Additional details:

* add test:watch script

resolves: #453
@misskniss misskniss added this to the V2 Alpha milestone May 3, 2022
@misskniss misskniss added V2 ALPHA site Area: frontend dashboard labels Jun 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
site Area: frontend dashboard
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants