🔧 Fixed some issues with axios cached instance
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
"@types/socket.io-client": "^3.0.0",
|
||||
"airdcpp-apisocket": "^2.4.4",
|
||||
"array-sort-by": "^1.2.1",
|
||||
"axios-cache-interceptor": "^0.8.8",
|
||||
"axios-simple-cache-adapter": "^1.1.0",
|
||||
"babel-polyfill": "^6.26.0",
|
||||
"better-docs": "^2.3.2",
|
||||
"calibre-opds": "^1.0.7",
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import axios from "axios";
|
||||
import rateLimiter from "axios-rate-limit";
|
||||
import { AxiosCacheRequestConfig, createCacheAdapter } from 'axios-simple-cache-adapter';
|
||||
|
||||
|
||||
import qs from "qs";
|
||||
import {
|
||||
@@ -23,11 +25,8 @@ import {
|
||||
LIBRARY_SERVICE_BASE_URI,
|
||||
} from "../constants/endpoints";
|
||||
|
||||
import { setupCache } from "axios-cache-interceptor";
|
||||
|
||||
// same object, but with updated typings.
|
||||
const axiosWithCache = setupCache(axios);
|
||||
|
||||
const axiosCacheAdapter = createCacheAdapter();
|
||||
const http = rateLimiter(axios.create(), {
|
||||
maxRequests: 1,
|
||||
perMilliseconds: 1000,
|
||||
@@ -39,11 +38,14 @@ export const getWeeklyPullList = (options) => async (dispatch) => {
|
||||
dispatch({
|
||||
type: CV_WEEKLY_PULLLIST_CALL_IN_PROGRESS,
|
||||
});
|
||||
axiosWithCache({
|
||||
url: `${COMICVINE_SERVICE_URI}/getWeeklyPullList`,
|
||||
|
||||
|
||||
await axios(`${COMICVINE_SERVICE_URI}/getWeeklyPullList`, {
|
||||
method: "get",
|
||||
params: options,
|
||||
}).then((response) => {
|
||||
axiosCacheAdapter,
|
||||
cache: 1000, // value in MS
|
||||
} as AxiosCacheRequestConfig).then((response) => {
|
||||
dispatch({
|
||||
type: CV_WEEKLY_PULLLIST_FETCHED,
|
||||
data: response.data.result,
|
||||
|
||||
@@ -173,7 +173,6 @@ export const fetchVolumeGroups = () => async (dispatch) => {
|
||||
url: `${LIBRARY_SERVICE_BASE_URI}/getComicBookGroups`,
|
||||
method: "GET",
|
||||
});
|
||||
|
||||
dispatch({
|
||||
type: IMS_COMIC_BOOK_GROUPS_FETCHED,
|
||||
data: response.data,
|
||||
@@ -265,10 +264,10 @@ export const extractComicArchive =
|
||||
|
||||
const imagePath = encodeURI(
|
||||
`${LIBRARY_SERVICE_HOST}/userdata/expanded/` +
|
||||
folderName +
|
||||
`/` +
|
||||
page.name +
|
||||
page.extension,
|
||||
folderName +
|
||||
`/` +
|
||||
page.name +
|
||||
page.extension,
|
||||
);
|
||||
comicBookPages.push(imagePath);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user