From 545d1ab99c78e4eed8bd0f6a9b0edcd26a79dfb9 Mon Sep 17 00:00:00 2001 From: "jue.hou" Date: Mon, 13 Jan 2025 13:52:23 +0200 Subject: [PATCH] Revert "skip simultaneous duplicated call" This reverts commit c453fbcc1f77870a5868be472f31c65be6128f10. --- client/util/apiConnection.js | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/client/util/apiConnection.js b/client/util/apiConnection.js index 3ce908a8..2a5711b0 100644 --- a/client/util/apiConnection.js +++ b/client/util/apiConnection.js @@ -5,7 +5,7 @@ import { Howl } from 'howler' /** * ApiConnection simplifies redux usage */ -const locks = {} + const getAxios = axios.create({ baseURL: `${basePath}api` }) export const callApi = async (url, method = 'get', data, query) => { @@ -22,25 +22,17 @@ export const callApi = async (url, method = 'get', data, query) => { }) } -export default (route, prefix, method = 'get', data, query, cache) => { - if (method==='get' && locks[route]) { - return { - type: `${prefix}_LOCKED`, - } - } - locks[route] = true - return { - type: `${prefix}_ATTEMPT`, - requestSettings: { - route, - method, - data, - prefix, - query, - cache, - }, - } -} +export default (route, prefix, method = 'get', data, query, cache) => ({ + type: `${prefix}_ATTEMPT`, + requestSettings: { + route, + method, + data, + prefix, + query, + cache, + }, +}) const SERVER_UNRESPONSIVE_STATUSES = [502, 503, 504] const SERVER_INTERNAL_ERROR_STATUS = 500 @@ -180,7 +172,6 @@ export const handleRequest = store => next => async action => { handleError(store, err, prefix, query) } } - locks[route] = false } }