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() { 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 } if (this.$store.state.graphqlClient.list && this.$store.state.graphqlClient.list[0]) { this.webViewUrl = this.url = this.$store.state.graphqlClient.list[0].url }
try { 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: { headers: {
'xc-auth': this.$store.state.users.token '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) { post(url, params) {
return this.$axios({ return this.$axios({
url: `${this.$axios.defaults.baseURL}${url}`, url: `${url}`,
method: 'post', method: 'post',
data: params 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]) // if (this.$store.state.graphqlClient.list && this.$store.state.graphqlClient.list[0])
// this.webViewUrl = this.url = this.$store.state.graphqlClient.list[0].url; // this.webViewUrl = this.url = this.$store.state.graphqlClient.list[0].url;
try { 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: { headers: {
'xc-auth': this.$store.state.users.token 'xc-auth': this.$store.state.users.token
} }

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

@ -290,7 +290,7 @@ export default {
methods: { methods: {
async loadProjectApiInfo() { async loadProjectApiInfo() {
try { 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: { headers: {
'xc-auth': this.$store.state.users.token 'xc-auth': this.$store.state.users.token
} }

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

@ -677,7 +677,7 @@ export default {
async loadProjectInfo() { async loadProjectInfo() {
if (this.$route.params.project_id) { if (this.$route.params.project_id) {
try { 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: { headers: {
'xc-auth': this.$store.state.users.token '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 // 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') store.dispatch('users/ActSignOut')
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
@ -48,7 +48,7 @@ export default ({ store, $axios, redirect, $toast }) => {
} }
// Try request again with new token // Try request again with new token
return $axios.post('/api/v1/auth/refresh-token', null, { return $axios.post('/auth/refresh-token', null, {
withCredentials: true withCredentials: true
}) })
.then((token) => { .then((token) => {

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

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

Loading…
Cancel
Save