Merge pull request #179 from dderbentsov/UC-162

[WIP] Переход на страницу логина, если токен просрочен
This commit is contained in:
frontgavrilin
2022-12-07 11:50:20 +03:00
committed by GitHub
2 changed files with 17 additions and 9 deletions

View File

@@ -105,9 +105,12 @@ export default {
this.employeesData = res.results;
},
fetchEmployeesData() {
fetchWrapper
.get("general/employee/")
.then((res) => this.saveEmployeesData(res));
fetchWrapper.get("general/employee/").then((res) => {
if (res.type === "client_error") {
localStorage.clear();
this.$router.push("/login");
} else this.saveEmployeesData(res);
});
},
fetchEventsData() {
fetchWrapper

View File

@@ -138,6 +138,10 @@ export default {
(this.currentTablePage - 1) * this.limit
}`
);
if (response.type === "client_error") {
localStorage.clear();
this.$router.push("/login");
} else {
this.saveDataClients(response);
this.saveClientsCount(response);
this.paginationInfo = {
@@ -145,6 +149,7 @@ export default {
length: this.calculatePageCount(this.clientsCount),
};
}
}
},
calculatePageCount(count) {
return Math.ceil(count / this.limit);