Browse Source

fix: hardcoded baseurl - ref to #264

Signed-off-by: Wing-Kam Wong <wingkwong.code@gmail.com>
pull/292/head
Wing-Kam Wong 3 years ago
parent
commit
b1f604ada7
  1. 4
      packages/nc-gui/components/changeEnv.vue
  2. 2
      packages/nc-gui/components/createOrEditProject.vue
  3. 4
      packages/nc-gui/components/project/settings/env.vue
  4. 3
      packages/nc-gui/components/project/xcInfo.vue
  5. 29
      packages/nc-gui/nuxt.config.js
  6. 3
      packages/nc-gui/pages/nc/_project_id.vue
  7. 4
      packages/nc-gui/pages/project/id.vue
  8. 12
      packages/nc-gui/pages/user/authentication/signin.vue
  9. 5
      packages/nc-gui/pages/user/authentication/signup/_token.vue
  10. 3
      packages/nc-gui/pages/user/authentication/signup/index.vue
  11. 27
      packages/nc-gui/plugins/projectLoader.js
  12. 5
      packages/nc-gui/store/graphqlClient.js
  13. 5
      packages/nc-gui/store/project.js
  14. 10
      packages/nc-gui/store/sqlMgr.js
  15. 5
      packages/nc-gui/store/users.js

4
packages/nc-gui/components/changeEnv.vue

@ -72,8 +72,7 @@
await new Promise(resolve => {
const interv = setInterval(() => {
axios.create({
baseURL: process.env.NODE_ENV === 'production' ? './' : 'http://localhost:8080/dashboard',
// baseURL: 'http://localhost:8080/dashboard',
baseURL: `${$axios.defaults.baseURL}/dashboard`,
}).get('').then(() => {
this.projectReloading = false;
clearInterval(interv);
@ -105,6 +104,7 @@
*
* @author Naveen MR <oof1lab@gmail.com>
* @author Pranav C Balan <pranavxc@gmail.com>
* @author Wing-Kam Wong <wingkwong.code@gmail.com>
*
* @license GNU AGPL version 3 or any later version
*

2
packages/nc-gui/components/createOrEditProject.vue

@ -1388,7 +1388,7 @@ export default {
this.allSchemas = true;
await this.$axios({
url: 'demo',
baseURL: process.env.NODE_ENV === 'production' ? './' : 'http://localhost:8080/dashboard',
baseURL: `${this.$axios.defaults.baseURL}/dashboard`,
});
},

4
packages/nc-gui/components/project/settings/env.vue

@ -62,8 +62,7 @@ export default {
await new Promise(resolve => {
const interv = setInterval(() => {
axios.create({
baseURL: process.env.NODE_ENV === 'production' ? './' : 'http://localhost:8080/dashboard',
// baseURL: 'http://localhost:8080/dashboard',
baseURL: `${$axios.defaults.baseURL}/dashboard`
}).get('').then(() => {
this.projectReloading = false;
clearInterval(interv);
@ -94,6 +93,7 @@ export default {
*
* @author Naveen MR <oof1lab@gmail.com>
* @author Pranav C Balan <pranavxc@gmail.com>
* @author Wing-Kam Wong <wingkwong.code@gmail.com>
*
* @license GNU AGPL version 3 or any later version
*

3
packages/nc-gui/components/project/xcInfo.vue

@ -241,7 +241,7 @@ export default {
async created() {
await this.loadProjectApiInfo();
try {
this.iframeUrl = this._isDev ? 'http://localhost:8080/dashboard/status' : './status';
this.iframeUrl = `${this.$axios.defaults.baseURL}/dashboard/status`;
const res = await this.$axios.get(this.iframeUrl);
this.showinfoIFrame = true;
} catch (e) {
@ -322,6 +322,7 @@ iframe {
*
* @author Naveen MR <oof1lab@gmail.com>
* @author Pranav C Balan <pranavxc@gmail.com>
* @author Wing-Kam Wong <wingkwong.code@gmail.com>
*
* @license GNU AGPL version 3 or any later version
*

29
packages/nc-gui/nuxt.config.js

@ -90,9 +90,7 @@ export default {
** See https://axios.nuxtjs.org/options
*/
axios: {
baseURL: process.env.NODE_ENV === 'production' ? '../' : 'http://localhost:8080/',
// baseURL: 'http://localhost:8080/',
// baseURL: 'http://localhost:8080/',
baseURL: process.env.NC_BACKEND_URL || 'http://localhost:8080',
},
/*
** vuetify module configuration
@ -217,6 +215,7 @@ export default {
*
* @author Naveen MR <oof1lab@gmail.com>
* @author Pranav C Balan <pranavxc@gmail.com>
* @author Wing-Kam Wong <wingkwong.code@gmail.com>
*
* @license GNU AGPL version 3 or any later version
*
@ -233,26 +232,4 @@ export default {
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
*
* @author Naveen MR <oof1lab@gmail.com>
* @author Pranav C Balan <pranavxc@gmail.com>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
*/

3
packages/nc-gui/pages/nc/_project_id.vue

@ -47,7 +47,7 @@ export default {
this.$router.replace({query: {}})
}
try {
hj('stateChange', 'http://localhost:8080/dashboard/#/nc/');
hj('stateChange', `${this.$axios.defaults.baseURL}/dashboard/#/nc/`);
} catch (e) {
}
},
@ -112,6 +112,7 @@ export default {
*
* @author Naveen MR <oof1lab@gmail.com>
* @author Pranav C Balan <pranavxc@gmail.com>
* @author Wing-Kam Wong <wingkwong.code@gmail.com>
*
* @license GNU AGPL version 3 or any later version
*

4
packages/nc-gui/pages/project/id.vue

@ -1113,8 +1113,7 @@ export default {
}
axios.create({
baseURL: process.env.NODE_ENV === 'production' ? './' : 'http://localhost:8080/dashboard',
// baseURL: 'http://localhost:8080/dashboard',
baseURL: `${$axios.defaults.baseURL}/dashboard`,
}).get('').then(() => {
toast.goAway(100);
this.projectReloading = false;
@ -1692,6 +1691,7 @@ export default {
*
* @author Naveen MR <oof1lab@gmail.com>
* @author Pranav C Balan <pranavxc@gmail.com>
* @author Wing-Kam Wong <wingkwong.code@gmail.com>
*
* @license GNU AGPL version 3 or any later version
*

12
packages/nc-gui/pages/user/authentication/signin.vue

@ -105,11 +105,7 @@
<div>
<v-btn
v-if="googleAuthEnabled"
:href="
_isDev
? 'http://localhost:8080/auth/google'
: '../auth/google'
"
:href="`${this.$axios.defaults.baseURL}/auth/google`"
outlined
large
elevation-10
@ -126,11 +122,7 @@
</v-btn>
<v-btn
v-if="githubAuthEnabled"
:href="
_isDev
? 'http://localhost:8080/auth/github'
: '../auth/github'
"
:href="`${this.$axios.defaults.baseURL}/auth/google`"
outlined
large
elevation-10

5
packages/nc-gui/pages/user/authentication/signup/_token.vue

@ -98,7 +98,7 @@
<v-btn
v-if="googleAuthEnabled"
:href="(_isDev ?'http://localhost:8080/auth/google':'../auth/google') + `?state=${token}`" outlined
:href="`${this.$axios.defaults.baseURL}/auth/google?state=${token}`" outlined
large elevation-10
block
color="blue">
@ -154,7 +154,7 @@
<!-- <v-btn
v-if="googleAuthEnabled"
:href="(_isDev ?'http://localhost:8080/auth/google':'../auth/google') + `?state=${token}`" outlined
:href="`${this.$axios.defaults.baseURL}/auth/google?state=${token}`" outlined
large elevation-10
block
color="blue">
@ -500,6 +500,7 @@ export default {
*
* @author Naveen MR <oof1lab@gmail.com>
* @author Pranav C Balan <pranavxc@gmail.com>
* @author Wing-Kam Wong <wingkwong.code@gmail.com>
*
* @license GNU AGPL version 3 or any later version
*

3
packages/nc-gui/pages/user/authentication/signup/index.vue

@ -131,7 +131,7 @@
<v-btn
v-if="googleAuthEnabled"
:href="_isDev ?'http://localhost:8080/auth/google':'../auth/google'" outlined large elevation-10
:href="`${this.$axios.defaults.baseURL}/auth/google`" outlined large elevation-10
block
color="blue">
<img :src="require('~/assets/img/gmail.png')"
@ -482,6 +482,7 @@ export default {
*
* @author Naveen MR <oof1lab@gmail.com>
* @author Pranav C Balan <pranavxc@gmail.com>
* @author Wing-Kam Wong <wingkwong.code@gmail.com>
*
* @license GNU AGPL version 3 or any later version
*

27
packages/nc-gui/plugins/projectLoader.js

@ -5,7 +5,7 @@ export default async ({store, redirect, $axios, $toast}) => {
&& /\bcode=/.test(window.location.search)) {
try {
const tokenData = await $axios.create({
baseURL: process.env.NODE_ENV === 'production' ? '../' : 'http://localhost:8080/',
baseURL: $axios.defaults.baseURL,
}).post(`/auth/${window.location.search.indexOf('state=github') > -1 ? 'github' : 'google'}/genTokenByCode${window.location.search}`);
store.commit('users/MutSetToken', tokenData.data.token);
@ -68,6 +68,7 @@ export default async ({store, redirect, $axios, $toast}) => {
*
* @author Naveen MR <oof1lab@gmail.com>
* @author Pranav C Balan <pranavxc@gmail.com>
* @author Wing-Kam Wong <wingkwong.code@gmail.com>
*
* @license GNU AGPL version 3 or any later version
*
@ -84,26 +85,4 @@ export default async ({store, redirect, $axios, $toast}) => {
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
*
* @author Naveen MR <oof1lab@gmail.com>
* @author Pranav C Balan <pranavxc@gmail.com>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
*/

5
packages/nc-gui/store/graphqlClient.js

@ -11,7 +11,7 @@ export const state = () => ({
*
*/
list: [{
url: 'http://localhost:8080/graphql'
url: `${process.env.NC_BACKEND_URL || 'http://localhost:8080'}/graphql`
}]
});
@ -33,13 +33,12 @@ export const actions = {
};
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
*
* @author Naveen MR <oof1lab@gmail.com>
* @author Pranav C Balan <pranavxc@gmail.com>
* @author Wing-Kam Wong <wingkwong.code@gmail.com>
*
* @license GNU AGPL version 3 or any later version
*

5
packages/nc-gui/store/project.js

@ -583,19 +583,20 @@ export const actions = {
async ActLoadProjectInfo({commit}) {
const projectInfo = (await this.$axios({
url: '/auth/type',
baseURL: process.env.NODE_ENV === 'production' ? './' : 'http://localhost:8080/dashboard',
// baseURL: 'http://localhost:8080/dashboard',
baseURL: `${this.$axios.defaults.baseURL}/dashboard`,
method: 'get'
})).data;
commit('MutProjectInfo', projectInfo)
}
};
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
*
* @author Naveen MR <oof1lab@gmail.com>
* @author Pranav C Balan <pranavxc@gmail.com>
* @author Wing-Kam Wong <wingkwong.code@gmail.com>
*
* @license GNU AGPL version 3 or any later version
*

10
packages/nc-gui/store/sqlMgr.js

@ -339,8 +339,7 @@ export const actions = {
// result = await state.sqlMgr.sqlOpPlus(args, op, opArgs);
result = (await this.$axios({
url: '?q=sqlOpPlus_' + op,
baseURL: process.env.NODE_ENV === 'production' ? './' : 'http://localhost:8080/dashboard',
// baseURL: 'http://localhost:8080/dashboard',
baseURL: `${this.$axios.defaults.baseURL}/dashboard`,
data: {api: op, ...args, ...params, args: opArgs, sqlOpPlus: true},
headers,
method: 'post'
@ -377,8 +376,7 @@ export const actions = {
}
return (await this.$axios({
url: '?q=sqlOp_' + op,
baseURL: process.env.NODE_ENV === 'production' ? './' : 'http://localhost:8080/dashboard',
// baseURL: 'http://localhost:8080/dashboard',
baseURL: `${this.$axios.defaults.baseURL}/dashboard`,
data: {api: op, ...args, ...params, args: opArgs},
headers,
method: 'post',
@ -423,8 +421,7 @@ export const actions = {
return (await this.$axios({
url: '?q=sqlOp_' + op,
baseURL: process.env.NODE_ENV === 'production' ? './' : 'http://localhost:8080/dashboard',
// baseURL: 'http://localhost:8080/dashboard',
baseURL: `${$this.axios.defaults.baseURL}/dashboard`,
data: formData, //{api: op, ...args, args: opArgs},
headers,
method: 'post',
@ -445,6 +442,7 @@ export const actions = {
*
* @author Naveen MR <oof1lab@gmail.com>
* @author Pranav C Balan <pranavxc@gmail.com>
* @author Wing-Kam Wong <wingkwong.code@gmail.com>
*
* @license GNU AGPL version 3 or any later version
*

5
packages/nc-gui/store/users.js

@ -497,8 +497,7 @@ export const actions = {
return (await this.$axios({
url: '/auth/admin/verify',
baseURL: process.env.NODE_ENV === 'production' ? './' : 'http://localhost:8080/dashboard',
// baseURL: 'http://localhost:8080/dashboard',
baseURL: `${this.$axios.defaults.baseURL}/dashboard`,
method: 'post',
data: {secret}
})).data;
@ -531,11 +530,13 @@ export const actions = {
// actions,
// mutations
// }
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
*
* @author Naveen MR <oof1lab@gmail.com>
* @author Pranav C Balan <pranavxc@gmail.com>
* @author Wing-Kam Wong <wingkwong.code@gmail.com>
*
* @license GNU AGPL version 3 or any later version
*

Loading…
Cancel
Save