From 5c49fedd425f9c86d5e91c82ea5c748204d35f5a Mon Sep 17 00:00:00 2001 From: lidaqiang Date: Wed, 22 Nov 2023 17:07:16 +0800 Subject: [PATCH 1/4] change dashboard baseurl --- dashboard/src/boot/axios.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dashboard/src/boot/axios.ts b/dashboard/src/boot/axios.ts index f40471af..a0eb5b6b 100644 --- a/dashboard/src/boot/axios.ts +++ b/dashboard/src/boot/axios.ts @@ -13,7 +13,8 @@ declare module '@vue/runtime-core' { // good idea to move this instance creation inside of the // "export default () => {}" function below (which runs individually // for each client) -const api = axios.create({ baseURL: '' }) +const baseURL = window.location.origin.replace('admin', 'api') + '/api' +const api = axios.create({ baseURL: baseURL }) export default boot(({ app }) => { // for use inside Vue files (Options API) through this.$axios and this.$api From b2f75f587c4d9101d4e9a74e0c431d6b4cb46fb0 Mon Sep 17 00:00:00 2001 From: lidaqiang Date: Wed, 22 Nov 2023 17:17:07 +0800 Subject: [PATCH 2/4] change dashboard baseurl --- dashboard/src/boot/axios.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dashboard/src/boot/axios.ts b/dashboard/src/boot/axios.ts index a0eb5b6b..e9776d62 100644 --- a/dashboard/src/boot/axios.ts +++ b/dashboard/src/boot/axios.ts @@ -13,7 +13,10 @@ declare module '@vue/runtime-core' { // good idea to move this instance creation inside of the // "export default () => {}" function below (which runs individually // for each client) -const baseURL = window.location.origin.replace('admin', 'api') + '/api' +let baseURL = window.location.origin.replace('dashboard', 'api') + '/api' +if (window.location.hostname.includes('.npool.top')) { + baseURL = window.location.protocol + '//api.web3eye.webui.io' + (window.location.port.length ? ':' + window.location.port : '') + '/api' +} const api = axios.create({ baseURL: baseURL }) export default boot(({ app }) => { From f72fdaa9ea6b22697756c192f9025f91403169c7 Mon Sep 17 00:00:00 2001 From: lidaqiang Date: Wed, 22 Nov 2023 17:21:06 +0800 Subject: [PATCH 3/4] update frontend baseurl --- webui/src/boot/axios.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/webui/src/boot/axios.ts b/webui/src/boot/axios.ts index f40471af..da92d7aa 100644 --- a/webui/src/boot/axios.ts +++ b/webui/src/boot/axios.ts @@ -13,7 +13,16 @@ declare module '@vue/runtime-core' { // good idea to move this instance creation inside of the // "export default () => {}" function below (which runs individually // for each client) -const api = axios.create({ baseURL: '' }) +let baseURL = window.location.protocol + '//api.' + window.location.hostname + '/api' +if (window.location.hostname.startsWith('www.')) { + baseURL = window.location.origin.replace('www', 'api') + '/api' +} +if (window.location.hostname.includes('.npool.top')) { + baseURL = window.location.protocol + '//api.web3eye.webui.io' + (window.location.port.length ? ':' + window.location.port : '') + '/api' +} + +// define +const api = axios.create({ baseURL: baseURL }) export default boot(({ app }) => { // for use inside Vue files (Options API) through this.$axios and this.$api From 9bb94f84b13a5e0b20cbf3ac341cf3dc1677013c Mon Sep 17 00:00:00 2001 From: lidaqiang Date: Wed, 22 Nov 2023 18:00:58 +0800 Subject: [PATCH 4/4] change baseurl --- dashboard/src/boot/axios.ts | 2 +- webui/src/boot/axios.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dashboard/src/boot/axios.ts b/dashboard/src/boot/axios.ts index e9776d62..dc68700f 100644 --- a/dashboard/src/boot/axios.ts +++ b/dashboard/src/boot/axios.ts @@ -15,7 +15,7 @@ declare module '@vue/runtime-core' { // for each client) let baseURL = window.location.origin.replace('dashboard', 'api') + '/api' if (window.location.hostname.includes('.npool.top')) { - baseURL = window.location.protocol + '//api.web3eye.webui.io' + (window.location.port.length ? ':' + window.location.port : '') + '/api' + baseURL = window.location.protocol + '//api.web3eye.npool.top' + (window.location.port.length ? ':' + window.location.port : '') + '/api' } const api = axios.create({ baseURL: baseURL }) diff --git a/webui/src/boot/axios.ts b/webui/src/boot/axios.ts index da92d7aa..ff245f8a 100644 --- a/webui/src/boot/axios.ts +++ b/webui/src/boot/axios.ts @@ -18,7 +18,7 @@ if (window.location.hostname.startsWith('www.')) { baseURL = window.location.origin.replace('www', 'api') + '/api' } if (window.location.hostname.includes('.npool.top')) { - baseURL = window.location.protocol + '//api.web3eye.webui.io' + (window.location.port.length ? ':' + window.location.port : '') + '/api' + baseURL = window.location.protocol + '//api.web3eye.npool.top' + (window.location.port.length ? ':' + window.location.port : '') + '/api' } // define