From 5f3e866a41161f52bf40ba2a91cd61629d9a1674 Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Tue, 30 Nov 2021 10:57:26 +0800 Subject: [PATCH] feat: support get api url from localstorage (halo-dev/console#388) --- src/utils/api-client.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/utils/api-client.js b/src/utils/api-client.js index 79097cff5..8cfd2ffd6 100644 --- a/src/utils/api-client.js +++ b/src/utils/api-client.js @@ -3,7 +3,9 @@ import store from '@/store' import { message, notification } from 'ant-design-vue' import { isObject } from './util' -const apiUrl = process.env.VUE_APP_API_URL ? process.env.VUE_APP_API_URL : 'http://localhost:8080' +const storedApiUrl = localStorage.getItem('apiUrl') + +const apiUrl = storedApiUrl ? storedApiUrl : process.env.VUE_APP_API_URL const haloRestApiClient = new HaloRestAPIClient({ baseUrl: apiUrl