diff --git a/package.json b/package.json index 818105a..d2455d2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "web-scraper-chrome-extension", - "version": "0.5", + "version": "0.5.1", "description": "Web data extraction tool implemented as chrome extension", "scripts": { "lint": "eslint --ext .js src", @@ -18,9 +18,8 @@ } }, "dependencies": { - "@vespaiach/axios-fetch-adapter": "^0.3.1", "@babel/runtime": "^7.10.5", - "axios": "^0.26.1", + "axios": "1.7.7", "bootstrap": "3.4.1", "d3": "^3.3.8", "icanhaz": "0.10.3", diff --git a/src/scripts/StoreRestApi.js b/src/scripts/StoreRestApi.js index c7fd014..6f7559f 100644 --- a/src/scripts/StoreRestApi.js +++ b/src/scripts/StoreRestApi.js @@ -2,14 +2,12 @@ import axios from 'axios'; import Sitemap from './Sitemap'; import StorePouchDB from './StorePouchDB'; import urlJoin from 'url-join'; -import fetchAdapter from '@vespaiach/axios-fetch-adapter'; export default class StoreRestApi { constructor(config, baseUrl, sitemapsPath = 'sitemaps/') { this.localDataStore = new StorePouchDB(config); this.axiosInstance = axios.create({ baseURL: baseUrl, - adapter: fetchAdapter, }); this.axiosInstance.defaults.headers.post['Content-Type'] = 'application/json'; this.axiosInstance.defaults.headers.put['Content-Type'] = 'application/json'; @@ -19,15 +17,11 @@ export default class StoreRestApi { setAxiosInterceptors() { this.axiosInstance.interceptors.response.use(response => { - //TODO return it when change axios to fetch - // const [contentType] = response.headers['content-type'].split(';'); - // if (contentType !== 'application/json') { - // const error = new Error(`Incorrect response type`); - // return Promise.reject(error); - // } - // if (response.headers['content-type']) { - // console.log(response.headers['content-type']); - // } + const [contentType] = response.headers['content-type'].split(';'); + if (contentType !== 'application/json') { + const error = new Error(`Incorrect response type`); + return Promise.reject(error); + } return response; }); } diff --git a/src/scripts/StoreTalismanApi.js b/src/scripts/StoreTalismanApi.js index 8f25d21..ceb057f 100644 --- a/src/scripts/StoreTalismanApi.js +++ b/src/scripts/StoreTalismanApi.js @@ -1,5 +1,4 @@ import axios from 'axios'; -import fetchAdapter from '@vespaiach/axios-fetch-adapter'; import StoreRestApi from './StoreRestApi'; import urlJoin from 'url-join'; import * as browser from 'webextension-polyfill'; @@ -36,7 +35,6 @@ export default class StoreTalismanApi extends StoreRestApi { const response = await axios({ method: 'get', url: urlJoin(this.axiosInstance.defaults.baseURL, 'meta.json'), - adapter: fetchAdapter, }); return response.data.APP_NAME; } @@ -102,7 +100,6 @@ export default class StoreTalismanApi extends StoreRestApi { const response = await axios({ method: 'get', url: `${tUrl}/oauth/token`, - adapter: fetchAdapter, }); try { if (response.data.preferred_username) {