diff --git a/packages/nc-gui/components/project/spreadsheet/apis/restApi.js b/packages/nc-gui/components/project/spreadsheet/apis/restApi.js index ce675416a3..02cb421db0 100644 --- a/packages/nc-gui/components/project/spreadsheet/apis/restApi.js +++ b/packages/nc-gui/components/project/spreadsheet/apis/restApi.js @@ -19,15 +19,29 @@ export default class RestApi { } async count(params) { - const data = await this.get(`/nc/${this.$ctx.$route.params.project_id}/api/v1/${this.table}/count`, params); - return data.data; + if (this.timeout) { + return this.timeout; + } + try { + const data = await this.get(`/nc/${this.$ctx.$route.params.project_id}/api/v1/${this.table}/count`, params, { + timeout: 10000, + }); + return data && data.data; + } catch (e) { + if (e.code === "ECONNABORTED") { + return this.timeout = {count: Infinity}; + } else { + throw e; + } + } } - get(url, params) { + get(url, params, extras = {}) { return this.$axios({ url, params, + ...extras }) } diff --git a/packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue b/packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue index b889d7cb3f..7b1bf7cc3c 100644 --- a/packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue +++ b/packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue @@ -57,7 +57,8 @@ mdi-reload - + mdi-plus @@ -214,7 +215,7 @@ +
+ Change page: + + + +
@@ -655,7 +673,7 @@ export default { const {row: rowObj, rowMeta} = this.data[row]; if (rowMeta.new) { try { - const pks =this.availableColumns.filter((col) => { + const pks = this.availableColumns.filter((col) => { return col.pk; }); if (this.availableColumns.every((col) => { diff --git a/packages/nc-gui/plugins/axiosInterceptor.js b/packages/nc-gui/plugins/axiosInterceptor.js index 6ba2393437..f0739af124 100644 --- a/packages/nc-gui/plugins/axiosInterceptor.js +++ b/packages/nc-gui/plugins/axiosInterceptor.js @@ -33,14 +33,14 @@ export default ({store, $axios, redirect, $toast}) => { } // Return any error which is not due to authentication back to the calling service - if (error.response && error.response.status !== 401) { + if (!error.response || error.response.status !== 401) { return new Promise((resolve, reject) => { reject(error); }); } // 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 == '/api/v1/auth/refresh-token' ) { store.dispatch('users/ActSignOut')