From 00e4bc4e16dd33a9719371e0ca7ea14da5bc9d0b Mon Sep 17 00:00:00 2001 From: Neeraj Sharma Date: Thu, 28 Nov 2019 19:06:15 +0530 Subject: [PATCH] fixed auntentication --- src/pages/Account/editInvoice.vue | 27 ++++++++++++++++++------- src/pages/Account/feeTypes.vue | 4 ++-- src/pages/Account/paymentHistory.vue | 1 + src/pages/Account/viewInvoice.vue | 8 +++++++- src/pages/Administrator/role.vue | 1 + src/pages/Attendence/viewStudentsAttendence.vue | 2 +- src/pages/Authentication/changepassword.vue | 8 +++++++- src/pages/Class/addclass.vue | 3 +-- src/pages/Dashboard/dashboard.vue | 19 +++++++++++------ src/pages/Event/event.vue | 2 +- src/pages/Library/eBook.vue | 2 +- src/pages/Library/issue.vue | 1 + src/pages/Library/member.vue | 3 ++- src/pages/Mark/mark.vue | 1 + src/pages/Mark/promotion.vue | 10 +++++++-- src/pages/News/news.vue | 2 +- src/pages/NoticeBoard/noticeBoard.vue | 2 +- src/pages/Notification/notification.vue | 2 +- src/pages/Parent/parents.vue | 9 ++++++++- src/pages/Reminder/reminder.vue | 2 +- src/pages/Report/studentReport.vue | 7 ++++++- src/pages/School/school.vue | 17 ++++++---------- src/pages/Section/section.vue | 2 +- src/pages/Students/students.vue | 16 +++++++-------- src/pages/Subjects/subjects.vue | 3 +-- src/pages/TimeTable/timeTable.vue | 21 ++++++++++++++----- 26 files changed, 117 insertions(+), 58 deletions(-) diff --git a/src/pages/Account/editInvoice.vue b/src/pages/Account/editInvoice.vue index 08e4322..6aeecd7 100644 --- a/src/pages/Account/editInvoice.vue +++ b/src/pages/Account/editInvoice.vue @@ -383,8 +383,14 @@ export default { (this.feeType.subTotal = response.data.data.totalSubTotal), (this.showLoader = false); }) - .catch(err => { + .catch(error => { this.showLoader = false; + if (error.response.status === 401) { + this.$router.replace({ path: "/" }); + this.$store.dispatch("setToken", null); + this.$store.dispatch("Id", null); + this.$store.dispatch("Role", null); + } }); }, selectFeeType() { @@ -414,8 +420,15 @@ export default { .then(response => { this.addclass = response.data.data; }) - .catch(err => { + .catch(error => { // console.log("err====>", err); + this.showLoader = false; + if (error.response.status === 401) { + this.$router.replace({ path: "/" }); + this.$store.dispatch("setToken", null); + this.$store.dispatch("Id", null); + this.$store.dispatch("Role", null); + } }); }, getAllStudents() { @@ -534,10 +547,10 @@ table.feeTypeTable { width: 100% !important; } @media screen and (max-width: 380px) { - .tableRsponsive { - display: block; - position: relative; - overflow: scroll; - } + .tableRsponsive { + display: block; + position: relative; + overflow: scroll; + } } \ No newline at end of file diff --git a/src/pages/Account/feeTypes.vue b/src/pages/Account/feeTypes.vue index 2c34edc..43caa6f 100644 --- a/src/pages/Account/feeTypes.vue +++ b/src/pages/Account/feeTypes.vue @@ -337,20 +337,20 @@ export default { this.showLoader = false; // console.log("getAllfeetypes=====>",response.data.data) }) - .catch(err => { + .catch(error => { // console.log("err====>", err); this.showLoader = false; if (error.response.status === 401) { this.$router.replace({ path: "/" }); this.$store.dispatch("setToken", null); this.$store.dispatch("Id", null); + this.$store.dispatch("Role", null); } }); }, editItem(item) { this.editedIndex = this.feeTypeList.indexOf(item); this.editedItem = Object.assign({}, item); - console.log(this.editedItem); this.dialog = true; }, profile(item) { diff --git a/src/pages/Account/paymentHistory.vue b/src/pages/Account/paymentHistory.vue index 6eab36c..cc6581c 100644 --- a/src/pages/Account/paymentHistory.vue +++ b/src/pages/Account/paymentHistory.vue @@ -137,6 +137,7 @@ export default { this.$router.replace({ path: "/" }); this.$store.dispatch("setToken", null); this.$store.dispatch("Id", null); + this.$store.dispatch("Role", null); } }); } diff --git a/src/pages/Account/viewInvoice.vue b/src/pages/Account/viewInvoice.vue index b393103..8c19beb 100644 --- a/src/pages/Account/viewInvoice.vue +++ b/src/pages/Account/viewInvoice.vue @@ -169,8 +169,14 @@ export default { (this.showLoader = false) )); }) - .catch(err => { + .catch(error => { this.showLoader = false; + if (error.response.status === 401) { + this.$router.replace({ path: "/" }); + this.$store.dispatch("setToken", null); + this.$store.dispatch("Id", null); + this.$store.dispatch("Role", null); + } }); }, getfeeType() { diff --git a/src/pages/Administrator/role.vue b/src/pages/Administrator/role.vue index 70ee1b0..89768b3 100644 --- a/src/pages/Administrator/role.vue +++ b/src/pages/Administrator/role.vue @@ -221,6 +221,7 @@ export default { this.$router.replace({ path: "/" }); this.$store.dispatch("setToken", null); this.$store.dispatch("Id", null); + this.$store.dispatch("Role", null); } }); }, diff --git a/src/pages/Attendence/viewStudentsAttendence.vue b/src/pages/Attendence/viewStudentsAttendence.vue index a29b9e0..3a1a182 100644 --- a/src/pages/Attendence/viewStudentsAttendence.vue +++ b/src/pages/Attendence/viewStudentsAttendence.vue @@ -340,12 +340,12 @@ export default { this.activeDates = array; }) .catch(error => { - console.log("err====>", err); this.showLoader = false; if (error.response.status === 401) { this.$router.replace({ path: "/" }); this.$store.dispatch("setToken", null); this.$store.dispatch("Id", null); + this.$store.dispatch("Role", null); } }); }, diff --git a/src/pages/Authentication/changepassword.vue b/src/pages/Authentication/changepassword.vue index b316998..34c8ad8 100644 --- a/src/pages/Authentication/changepassword.vue +++ b/src/pages/Authentication/changepassword.vue @@ -101,11 +101,17 @@ export default { this.$router.push("/dashboard"); }, 2000); }) - .catch(err => { + .catch(error => { // console.log("err====>",err); this.text = "User Not Found or Incorrect currentPassword"; this.snackbar = true; this.loading = false; + if (error.response.status === 401) { + this.$router.replace({ path: "/" }); + this.$store.dispatch("setToken", null); + this.$store.dispatch("Id", null); + this.$store.dispatch("Role", null); + } }); } }, diff --git a/src/pages/Class/addclass.vue b/src/pages/Class/addclass.vue index 054ecc7..a92fe1d 100644 --- a/src/pages/Class/addclass.vue +++ b/src/pages/Class/addclass.vue @@ -273,8 +273,7 @@ export default { this.desserts = response.data.data; this.showLoader = false; }) - .catch(err => { - console.log("err====>", err); + .catch(error => { this.showLoader = false; if (error.response.status === 401) { this.$router.replace({ path: "/" }); diff --git a/src/pages/Dashboard/dashboard.vue b/src/pages/Dashboard/dashboard.vue index c012062..69bb9de 100644 --- a/src/pages/Dashboard/dashboard.vue +++ b/src/pages/Dashboard/dashboard.vue @@ -56,7 +56,12 @@ - class + class
Class
@@ -187,6 +192,7 @@ export default { this.$router.replace({ path: "/" }); this.$store.dispatch("setToken", null); this.$store.dispatch("Id", null); + this.$store.dispatch("Role", null); } }); http() @@ -207,6 +213,7 @@ export default { this.$router.replace({ path: "/" }); this.$store.dispatch("setToken", null); this.$store.dispatch("Id", null); + this.$store.dispatch("Role", null); } }); }, @@ -219,7 +226,7 @@ export default { this.students = response.data.data; this.showLoader = false; }) - .catch(err => { + .catch(error => { // console.log("err====>", err); this.showLoader = false; if (error.response.status === 401) { @@ -238,7 +245,7 @@ export default { this.parents = response.data.data; this.showLoader = false; }) - .catch(err => { + .catch(error => { // console.log("err====>", err); this.showLoader = false; if (error.response.status === 401) { @@ -257,7 +264,7 @@ export default { this.teachers = response.data.data; this.showLoader = false; }) - .catch(err => { + .catch(error => { // console.log("err====>", err); this.showLoader = false; if (error.response.status === 401) { @@ -276,13 +283,13 @@ export default { this.classes = response.data.data; this.showLoader = false; }) - .catch(err => { - // console.log("err====>", err); + .catch(error => { this.showLoader = false; if (error.response.status === 401) { this.$router.replace({ path: "/" }); this.$store.dispatch("setToken", null); this.$store.dispatch("Id", null); + this.$store.dispatch("Role", null); } }); } diff --git a/src/pages/Event/event.vue b/src/pages/Event/event.vue index 020c5d3..792a6ad 100644 --- a/src/pages/Event/event.vue +++ b/src/pages/Event/event.vue @@ -411,7 +411,7 @@ export default { this.desserts = response.data.data; this.showLoader = false; }) - .catch(err => { + .catch(error => { // console.log("err====>", err); this.showLoader = false; if (error.response.status === 401) { diff --git a/src/pages/Library/eBook.vue b/src/pages/Library/eBook.vue index d1f7ba0..5c5676a 100644 --- a/src/pages/Library/eBook.vue +++ b/src/pages/Library/eBook.vue @@ -543,7 +543,7 @@ export default { this.eBookData = response.data.data; this.showLoader = false; }) - .catch(err => { + .catch(error => { // console.log("err====>", err); this.showLoader = false; if (error.response.status === 401) { diff --git a/src/pages/Library/issue.vue b/src/pages/Library/issue.vue index 83ccbc1..4e578ee 100644 --- a/src/pages/Library/issue.vue +++ b/src/pages/Library/issue.vue @@ -626,6 +626,7 @@ export default { this.$router.replace({ path: "/" }); this.$store.dispatch("setToken", null); this.$store.dispatch("Id", null); + this.$store.dispatch("Role", null); } }); }, diff --git a/src/pages/Library/member.vue b/src/pages/Library/member.vue index 21a79c2..a865cc0 100644 --- a/src/pages/Library/member.vue +++ b/src/pages/Library/member.vue @@ -633,12 +633,13 @@ export default { this.studentData = response.data.data; this.showLoader = false; }) - .catch(err => { + .catch(error => { // console.log("err====>", err); if (error.response.status === 401) { this.$router.replace({ path: "/" }); this.$store.dispatch("setToken", null); this.$store.dispatch("Id", null); + this.$store.dispatch("Role", null); } }); }, diff --git a/src/pages/Mark/mark.vue b/src/pages/Mark/mark.vue index c7d5a1f..8520201 100644 --- a/src/pages/Mark/mark.vue +++ b/src/pages/Mark/mark.vue @@ -446,6 +446,7 @@ export default { this.$router.replace({ path: "/" }); this.$store.dispatch("setToken", null); this.$store.dispatch("Id", null); + this.$store.dispatch("Role", null); } }); }, diff --git a/src/pages/Mark/promotion.vue b/src/pages/Mark/promotion.vue index 7d12868..7531225 100644 --- a/src/pages/Mark/promotion.vue +++ b/src/pages/Mark/promotion.vue @@ -216,8 +216,14 @@ export default { .then(response => { this.classList = response.data.data; }) - .catch(err => { - // console.log("err====>", err); + .catch(error => { + this.showLoader = false; + if (error.response.status === 401) { + this.$router.replace({ path: "/" }); + this.$store.dispatch("setToken", null); + this.$store.dispatch("Id", null); + this.$store.dispatch("Role", null); + } }); } } diff --git a/src/pages/News/news.vue b/src/pages/News/news.vue index 6d41dba..aac9734 100644 --- a/src/pages/News/news.vue +++ b/src/pages/News/news.vue @@ -532,7 +532,7 @@ export default { this.showLoader = false; // console.log("getNewsList=====>",this.desserts) }) - .catch(err => { + .catch(error => { // console.log("err====>", err); this.showLoader = false; if (error.response.status === 401) { diff --git a/src/pages/NoticeBoard/noticeBoard.vue b/src/pages/NoticeBoard/noticeBoard.vue index c47c3a4..6a949ab 100644 --- a/src/pages/NoticeBoard/noticeBoard.vue +++ b/src/pages/NoticeBoard/noticeBoard.vue @@ -456,7 +456,7 @@ export default { this.desserts = response.data.data; this.showLoader = false; }) - .catch(err => { + .catch(error => { this.showLoader = false; if (error.response.status === 401) { this.$router.replace({ path: "/" }); diff --git a/src/pages/Notification/notification.vue b/src/pages/Notification/notification.vue index abf3315..3382ae2 100644 --- a/src/pages/Notification/notification.vue +++ b/src/pages/Notification/notification.vue @@ -363,7 +363,7 @@ export default { this.showLoader = false; // console.log("getNotifications=====>",this.desserts) }) - .catch(err => { + .catch(error => { // console.log("err====>", err); this.showLoader = false; if (error.response.status === 401) { diff --git a/src/pages/Parent/parents.vue b/src/pages/Parent/parents.vue index 68ca314..2f81748 100644 --- a/src/pages/Parent/parents.vue +++ b/src/pages/Parent/parents.vue @@ -628,7 +628,14 @@ export default { this.parentsList = response.data.data; }) .catch(error => { - console.log("err====>", error.response.data.message); + // console.log("err====>", error.response.data.message); + this.showLoader = false; + if (error.response.status === 401) { + this.$router.replace({ path: "/" }); + this.$store.dispatch("setToken", null); + this.$store.dispatch("Id", null); + this.$store.dispatch("Role", null); + } }); } }, diff --git a/src/pages/Reminder/reminder.vue b/src/pages/Reminder/reminder.vue index 3187252..be794d4 100644 --- a/src/pages/Reminder/reminder.vue +++ b/src/pages/Reminder/reminder.vue @@ -453,7 +453,7 @@ export default { this.showLoader = false; // console.log("getRemindersList=====>",this.desserts) }) - .catch(err => { + .catch(error => { // console.log("err====>", err); this.showLoader = false; if (error.response.status === 401) { diff --git a/src/pages/Report/studentReport.vue b/src/pages/Report/studentReport.vue index 954ce27..5a812b1 100644 --- a/src/pages/Report/studentReport.vue +++ b/src/pages/Report/studentReport.vue @@ -349,7 +349,12 @@ export default { }) .catch(err => { this.showLoader = false; - // console.log("err====>", err); + if (error.response.status === 401) { + this.$router.replace({ path: "/" }); + this.$store.dispatch("setToken", null); + this.$store.dispatch("Id", null); + this.$store.dispatch("Role", null); + } }); }, getReport() { diff --git a/src/pages/School/school.vue b/src/pages/School/school.vue index 3888833..05aafa0 100644 --- a/src/pages/School/school.vue +++ b/src/pages/School/school.vue @@ -1113,8 +1113,13 @@ export default { this.showLoader = false; }) .catch(error => { - console.log("err====>", err); this.showLoader = false; + if (error.response.status === 401) { + this.$router.replace({ path: "/" }); + this.$store.dispatch("setToken", null); + this.$store.dispatch("Id", null); + this.$store.dispatch("Role", null); + } }); }, pickFile() { @@ -1148,19 +1153,9 @@ export default { editItem(item) { this.editedIndex = this.schoolList.indexOf(item); this.editedItem = Object.assign({}, item); - // if(this.editedItem.dob != undefined){ - // this.editedItem.dob = this.editedItem.dob.substring(0, 10) - // }else if(this.editedItem.dob = undefined){ - // this.editedItem.dob = '' - // } - this.editedItem.dob = - this.editedItem.dob != undefined - ? (this.editedItem.dob = this.editedItem.dob.substring(0, 10)) - : (this.editedItem.dob = ""); this.dialog = true; }, profile(item) { - console.log("item", item); this.editedIndex = this.schoolList.indexOf(item); this.editedItem = Object.assign({}, item); this.dialog1 = true; diff --git a/src/pages/Section/section.vue b/src/pages/Section/section.vue index 8f86c11..5a3c05c 100644 --- a/src/pages/Section/section.vue +++ b/src/pages/Section/section.vue @@ -426,7 +426,7 @@ export default { }) .catch(error => { this.showLoader = false; - if (error.response.status === 401 && error.response.status === 401) { + if (error.response.status === 401) { this.$router.replace({ path: "/" }); this.$store.dispatch("setToken", null); this.$store.dispatch("Id", null); diff --git a/src/pages/Students/students.vue b/src/pages/Students/students.vue index 0cc4db2..091c30d 100644 --- a/src/pages/Students/students.vue +++ b/src/pages/Students/students.vue @@ -1973,11 +1973,6 @@ export default { this.editedItem.fatherCellNo = item.parentId.fatherCellNo; this.editedItem.motherName = item.parentId.motherName; this.editedItem.motherCellNo = item.parentId.motherCellNo; - // if(this.editedItem.dob != undefined){ - // this.editedItem.dob = this.editedItem.dob.substring(0, 10) - // }else if(this.editedItem.dob = undefined){ - // this.editedItem.dob = '' - // } this.editedItem.dob = this.editedItem.dob != undefined ? (this.editedItem.dob = this.editedItem.dob.substring(0, 10)) @@ -2207,9 +2202,14 @@ export default { .then(response => { this.addclass = response.data.data; }) - .catch(err => { - // console.log("err====>", err); - this.$router.replace({ path: "/" }); + .catch(error => { + this.showLoader = false; + if (error.response.status === 401) { + this.$router.replace({ path: "/" }); + this.$store.dispatch("setToken", null); + this.$store.dispatch("Id", null); + this.$store.dispatch("Role", null); + } }); }, created() { diff --git a/src/pages/Subjects/subjects.vue b/src/pages/Subjects/subjects.vue index b9943f3..ba91073 100644 --- a/src/pages/Subjects/subjects.vue +++ b/src/pages/Subjects/subjects.vue @@ -467,8 +467,7 @@ export default { .then(response => { this.classList = response.data.data; }) - .catch(err => { - // console.log("err====>", err); + .catch(error => { if (error.response.status === 401) { this.$router.replace({ path: "/" }); this.$store.dispatch("setToken", null); diff --git a/src/pages/TimeTable/timeTable.vue b/src/pages/TimeTable/timeTable.vue index f3f9a49..5b187fd 100644 --- a/src/pages/TimeTable/timeTable.vue +++ b/src/pages/TimeTable/timeTable.vue @@ -927,7 +927,6 @@ export default { this.desserts = response.data.data; }) .catch(error => { - console.log("err====>", error); if ((this.snackbar = true)) { this.text = error.response.data.message; this.text = error.response.data.statusText; @@ -1286,8 +1285,14 @@ export default { this.addclass = response.data.data; // console.log("getClassesList=====>",this.addclass) }) - .catch(err => { - // console.log("err====>", err); + .catch(error => { + this.showLoader = false; + if (error.response.status === 401) { + this.$router.replace({ path: "/" }); + this.$store.dispatch("setToken", null); + this.$store.dispatch("Id", null); + this.$store.dispatch("Role", null); + } }); http() @@ -1298,8 +1303,14 @@ export default { this.addTeachers = response.data.data; // console.log("getClassesList=====>",this.addTeachers) }) - .catch(err => { - // console.log("err====>", err); + .catch(error => { + this.showLoader = false; + if (error.response.status === 401) { + this.$router.replace({ path: "/" }); + this.$store.dispatch("setToken", null); + this.$store.dispatch("Id", null); + this.$store.dispatch("Role", null); + } }); }, created() { -- 2.0.0