[WIP] Фикс просроченного токена

This commit is contained in:
megavrilinvv
2022-12-07 14:51:12 +03:00
parent a4240f3651
commit a42d8aa30a
5 changed files with 23 additions and 36 deletions

View File

@@ -104,16 +104,10 @@ export default {
saveEmployeesData(res) {
this.employeesData = res.results;
},
logout() {
localStorage.removeItem("tokenAccess");
this.$router.push("/login");
},
fetchEmployeesData() {
fetchWrapper.get("general/employee/").then((res) => {
if (res.type === "client_error") {
this.logout();
} else this.saveEmployeesData(res);
});
fetchWrapper
.get("general/employee/")
.then((res) => this.saveEmployeesData(res));
},
fetchEventsData() {
fetchWrapper

View File

@@ -118,10 +118,6 @@ export default {
this.fetchDataClients();
}
},
logout() {
localStorage.removeItem("tokenAccess");
this.$router.push("/login");
},
async fetchDataClients() {
let response = {};
if (this.textSearch) {
@@ -130,32 +126,24 @@ export default {
this.limit
}&offset=${(this.currentTablePage - 1) * this.limit}`
);
if (response.type === "client_error") {
this.logout();
} else {
this.saveDataClients(response);
this.saveFilteredClientsCount(response);
this.paginationInfo = {
currentPage: this.currentTablePage,
length: this.calculatePageCount(this.filteredClientsCount),
};
}
this.saveDataClients(response);
this.saveFilteredClientsCount(response);
this.paginationInfo = {
currentPage: this.currentTablePage,
length: this.calculatePageCount(this.filteredClientsCount),
};
} else {
response = await fetchWrapper.get(
`general/person/?limit=${this.limit}&offset=${
(this.currentTablePage - 1) * this.limit
}`
);
if (response.type === "client_error") {
this.logout();
} else {
this.saveDataClients(response);
this.saveClientsCount(response);
this.paginationInfo = {
currentPage: this.currentTablePage,
length: this.calculatePageCount(this.clientsCount),
};
}
this.saveDataClients(response);
this.saveClientsCount(response);
this.paginationInfo = {
currentPage: this.currentTablePage,
length: this.calculatePageCount(this.clientsCount),
};
}
},
calculatePageCount(count) {

View File

@@ -87,7 +87,7 @@ export default {
<style lang="sass" scoped>
.wrapper-info
min-height: 443px
min-height: 336px
max-height: 443px
overflow-y: auto
color: var(--font-grey-color)