From 017f65a4f3341fca135dfcafa33b1f0eac422e47 Mon Sep 17 00:00:00 2001 From: Disha Talreja Date: Mon, 14 Nov 2022 15:25:34 +0530 Subject: [PATCH] Added support to alias specific instance URL with environment configuration(#30dkjp1) --- .env.example | 3 ++- src/views/Login.vue | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index 5ab9fe0d..09e1d8e1 100644 --- a/.env.example +++ b/.env.example @@ -3,4 +3,5 @@ VUE_APP_I18N_FALLBACK_LOCALE=en VUE_APP_CACHE_MAX_AGE=3600 VUE_APP_VIEW_SIZE=10 VUE_APP_BASE_URL= -VUE_APP_PERMISSION_ID= \ No newline at end of file +VUE_APP_PERMISSION_ID= +VUE_APP_ALIAS= \ No newline at end of file diff --git a/src/views/Login.vue b/src/views/Login.vue index 305c410d..9fb0b656 100644 --- a/src/views/Login.vue +++ b/src/views/Login.vue @@ -57,7 +57,8 @@ export default defineComponent({ username: "", password: "", instanceUrl: "", - baseURL: process.env.VUE_APP_BASE_URL + baseURL: process.env.VUE_APP_BASE_URL, + alias: process.env.VUE_APP_ALIAS ? JSON.parse(process.env.VUE_APP_ALIAS) : {} }; }, computed: { @@ -70,8 +71,8 @@ export default defineComponent({ }, methods: { login: function () { - if(!this.baseURL) this.store.dispatch("user/setUserInstanceUrl", this.instanceUrl.trim().toLowerCase()) - const { username, password } = this; + const instanceURL = this.instanceUrl.trim().toLowerCase(); + if(!this.baseURL) this.store.dispatch("user/setUserInstanceUrl", this.alias[instanceURL] ? this.alias[instanceURL] : instanceURL); const { username, password } = this; this.store.dispatch("user/login", { username: username.trim(), password }).then((data: any) => { if (data.token) { this.username = ''