Skip to content
This repository has been archived by the owner on May 17, 2021. It is now read-only.

Commit

Permalink
Replace axios with fetch
Browse files Browse the repository at this point in the history
Given the open issue axios/axios#1098, I decided to remove axios from
the example project.
  • Loading branch information
Christopher Duncan committed May 30, 2019
1 parent e34f25e commit d199998
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 34 deletions.
43 changes: 13 additions & 30 deletions example/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion example/package.json
Expand Up @@ -9,9 +9,10 @@
"build": "tsc"
},
"dependencies": {
"axios": "^0.18.0",
"@types/node-fetch": "^2.3.4",
"decoder-js": "^1.0.0",
"fp-ts": "^1.9.0",
"node-fetch": "^2.6.0",
"typescript": "^3.1.1"
}
}
7 changes: 4 additions & 3 deletions example/src/index.ts
@@ -1,11 +1,12 @@
/* tslint:disable:no-console */

import axios from 'axios';
import Decoder, { Decoded } from 'decoder-js';
import fetch from 'node-fetch';
import Cause from './Cause';

axios.get('https://data.cdc.gov/api/views/6rkc-nb2q/rows.json')
.then(({ data }) => {
fetch('https://data.cdc.gov/api/views/6rkc-nb2q/rows.json')
.then((response) => response.json())
.then((data) => {
const causesResult: Decoded<Cause[]> = decoder.run(data);

causesResult.fold(
Expand Down

0 comments on commit d199998

Please sign in to comment.