diff --git a/index.ts b/index.ts index 46251b1..4ef8288 100644 --- a/index.ts +++ b/index.ts @@ -1,5 +1,3 @@ -import axios from 'axios'; - type GameMode = '1v1' | // 1v1 Arena 'ball' | // Gridiron @@ -54,13 +52,14 @@ const COD_API_ENDPOINT = 'https://my.callofduty.com/api/papi-client'; // API Helper function getDataFromAPI(uri: string) { - return axios.get(uri) - .then(({ data }) => { - const { status, data: error } = data; + return fetch(uri) + .then(response => response.json()) + .then(response => { + const { status, data: error } = response; if (status !== 'success') { throw new Error(`cod-api request failed: ${error.message}`); } - return data; + return response; }); } diff --git a/package-lock.json b/package-lock.json index e2f8c6a..ae8cf3d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,44 +1,9 @@ { "name": "cod-api", - "version": "3.1.1", + "version": "3.2.1", "lockfileVersion": 1, "requires": true, "dependencies": { - "axios": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.18.0.tgz", - "integrity": "sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI=", - "requires": { - "follow-redirects": "1.5.5", - "is-buffer": "1.1.6" - } - }, - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "requires": { - "ms": "2.0.0" - } - }, - "follow-redirects": { - "version": "1.5.5", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.5.tgz", - "integrity": "sha512-GHjtHDlY/ehslqv0Gr5N0PUJppgg/q0rOBvX0na1s7y1A3LWxPqCYU76s3Z1bM4+UZB4QF0usaXLT5wFpof5PA==", - "requires": { - "debug": "3.1.0" - } - }, - "is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, "typescript": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.0.1.tgz", diff --git a/package.json b/package.json index 392664b..92e7cc8 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,6 @@ ], "license": "MIT", "dependencies": { - "axios": "^0.18.0", "typescript": "^3.0.1" }, "repository": "github:jakejrichards/cod-api",