Browse Source

fix: Remove unnecessary baseurl appending, Correction in refresh token api

re #428

Signed-off-by: Pranav C <61551451+pranavxc@users.noreply.github.com>
pull/431/head
Pranav C 3 years ago
parent
commit
83db607c31
  1. 2
      packages/nc-gui/components/project/graphqlClient.vue
  2. 2
      packages/nc-gui/components/project/spreadsheet/apis/gqlApi.js
  3. 2
      packages/nc-gui/components/project/swaggerClient.vue
  4. 2
      packages/nc-gui/components/project/xcInfo.vue
  5. 2
      packages/nc-gui/layouts/default.vue
  6. 4
      packages/nc-gui/plugins/axiosInterceptor.js
  7. 2
      packages/nc-gui/plugins/ncApis/gqlApi.js

2
packages/nc-gui/components/project/graphqlClient.vue

@ -56,7 +56,7 @@ export default {
async created() {
if (this.$store.state.graphqlClient.list && this.$store.state.graphqlClient.list[0]) { this.webViewUrl = this.url = this.$store.state.graphqlClient.list[0].url }
try {
const { info } = (await this.$axios.get(`${this.$axios.defaults.baseURL}/nc/${this.$route.params.project_id}/projectApiInfo`, {
const { info } = (await this.$axios.get(`/nc/${this.$route.params.project_id}/projectApiInfo`, {
headers: {
'xc-auth': this.$store.state.users.token
}

2
packages/nc-gui/components/project/spreadsheet/apis/gqlApi.js

@ -27,7 +27,7 @@ export default class GqlApi {
post(url, params) {
return this.$axios({
url: `${this.$axios.defaults.baseURL}${url}`,
url: `${url}`,
method: 'post',
data: params
})

2
packages/nc-gui/components/project/swaggerClient.vue

@ -57,7 +57,7 @@ export default {
// if (this.$store.state.graphqlClient.list && this.$store.state.graphqlClient.list[0])
// this.webViewUrl = this.url = this.$store.state.graphqlClient.list[0].url;
try {
const { info } = (await this.$axios.get(`${this.$axios.defaults.baseURL}/nc/${this.$route.params.project_id}/projectApiInfo`, {
const { info } = (await this.$axios.get(`/nc/${this.$route.params.project_id}/projectApiInfo`, {
headers: {
'xc-auth': this.$store.state.users.token
}

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

@ -290,7 +290,7 @@ export default {
methods: {
async loadProjectApiInfo() {
try {
const { info, aggregatedInfo } = (await this.$axios.get(`${this.$axios.defaults.baseURL}/nc/${this.$route.params.project_id}/projectApiInfo`, {
const { info, aggregatedInfo } = (await this.$axios.get(`/nc/${this.$route.params.project_id}/projectApiInfo`, {
headers: {
'xc-auth': this.$store.state.users.token
}

2
packages/nc-gui/layouts/default.vue

@ -677,7 +677,7 @@ export default {
async loadProjectInfo() {
if (this.$route.params.project_id) {
try {
const { info } = (await this.$axios.get(`${this.$axios.defaults.baseURL}/nc/${this.$route.params.project_id}/projectApiInfo`, {
const { info } = (await this.$axios.get(`/nc/${this.$route.params.project_id}/projectApiInfo`, {
headers: {
'xc-auth': this.$store.state.users.token
}

4
packages/nc-gui/plugins/axiosInterceptor.js

@ -39,7 +39,7 @@ export default ({ store, $axios, redirect, $toast }) => {
}
// Logout user if token refresh didn't work or user is disabled
if (error.config.url === '/api/v1/auth/refresh-token') {
if (error.config.url === '/auth/refresh-token') {
store.dispatch('users/ActSignOut')
return new Promise((resolve, reject) => {
@ -48,7 +48,7 @@ export default ({ store, $axios, redirect, $toast }) => {
}
// Try request again with new token
return $axios.post('/api/v1/auth/refresh-token', null, {
return $axios.post('/auth/refresh-token', null, {
withCredentials: true
})
.then((token) => {

2
packages/nc-gui/plugins/ncApis/gqlApi.js

@ -31,7 +31,7 @@ export default class GqlApi {
post(url, params) {
return this.$axios({
url: `${this.$axios.defaults.baseURL}${url}`,
url: `${url}`,
method: 'post',
data: params
})

Loading…
Cancel
Save