summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2021-03-26 02:10:59 +0300
committereug-vs <eug-vs@keemail.me>2021-03-26 02:10:59 +0300
commitb39bdd64e00f368a06a83d0fd2de80c6eb89c875 (patch)
tree5ce39e776596c6cbed788f24dd20a47290f9d4fc
parentef742ea9b2f246f74eae74169675a331679ad41c (diff)
downloadcommercel-ui-b39bdd64e00f368a06a83d0fd2de80c6eb89c875.tar.gz
fix: do not override custom service API
-rw-r--r--src/hooks/useAPIClient.ts2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/hooks/useAPIClient.ts b/src/hooks/useAPIClient.ts
index e992b42..c7e8d31 100644
--- a/src/hooks/useAPIClient.ts
+++ b/src/hooks/useAPIClient.ts
@@ -9,6 +9,8 @@ const fetcher = (endpoint: string) => get(endpoint).then(response => response.da
const hooks: any = {};
const registerServiceHooks = <Item = any>(service: string): void => {
+ if (hooks[service]) return;
+
const useList = (query = '', options = {}): Response<Item[]> => {
return useSWR(`/${service}${query}`, fetcher, options);
};