From 1c32b05abe2f1a7df326d8254feec1be5459f8a8 Mon Sep 17 00:00:00 2001 From: Miguel Medeiros Date: Fri, 23 Jul 2021 17:36:40 -0300 Subject: [PATCH] Add localhost support. --- src/services/api/index.ts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/services/api/index.ts b/src/services/api/index.ts index 863cec455..566151a43 100644 --- a/src/services/api/index.ts +++ b/src/services/api/index.ts @@ -10,6 +10,16 @@ export const makeBitcoinAPI = ({ } else { network = ''; } + + if(hostname?.includes("localhost")){ + const api = axios.create({ + baseURL: `http://${hostname}${network}/api/`, + }); + return { + api, + }; + } + const api = axios.create({ baseURL: `https://${hostname}${network}/api/`, }); @@ -19,6 +29,16 @@ export const makeBitcoinAPI = ({ }; export const makeBisqAPI = (hostname?: string): { api: AxiosInstance } => { + + if(hostname?.includes("localhost")){ + const api = axios.create({ + baseURL: `http://${hostname}/bisq/api/`, + }); + return { + api, + }; + } + const api = axios.create({ baseURL: `https://${hostname}/bisq/api/`, }); @@ -28,6 +48,16 @@ export const makeBisqAPI = (hostname?: string): { api: AxiosInstance } => { }; export const makeLiquidAPI = (hostname?: string): { api: AxiosInstance } => { + + if(hostname?.includes("localhost")){ + const api = axios.create({ + baseURL: `http://${hostname}/liquid/api/`, + }); + return { + api, + }; + } + const api = axios.create({ baseURL: `https://${hostname}/liquid/api/`, });