diff --git a/src/pages/Authentication/Login.vue b/src/pages/Authentication/Login.vue index 230fe54..0add740 100644 --- a/src/pages/Authentication/Login.vue +++ b/src/pages/Authentication/Login.vue @@ -106,7 +106,7 @@ export default { }; }, methods: { - login() { + async login() { if (this.$refs.form.validate()) { this.loading = true; var userdata = { @@ -147,6 +147,7 @@ export default { this.$store.dispatch("setToken", response.data.data.token); this.$store.dispatch("Id", response.data.data.id); this.$store.dispatch("Role", response.data.data.role); + localStorage.setItem("parentStudentId", response.data.data.id); this.$router.push("/dashboard"); } }) diff --git a/src/pages/Dashboard/dashboard.vue b/src/pages/Dashboard/dashboard.vue index 8e35023..b9bec2c 100644 --- a/src/pages/Dashboard/dashboard.vue +++ b/src/pages/Dashboard/dashboard.vue @@ -102,7 +102,7 @@ - + @@ -897,38 +897,41 @@ export default { this.showLoader = false; }); }, - getparentStudents() { + async getparentStudents() { this.showLoader = true; - http() + var parentStudentsId; + var classId; + await http() .get("/parentStudentsList") .then(response => { // console.log("resssssss", response.data.data.students[0].classId); this.studentsData = response.data.data; - // localStorage.setItem( - // "parentStudentId", - // this.studentsData.students[0]._id - // ); - // localStorage.setItem( - // "parentClassId", - // this.studentsData.students[0].classId - // ); + localStorage.setItem( + "parentStudentId", + this.studentsData.students[0]._id + ); + localStorage.setItem( + "parentClassId", + this.studentsData.students[0].classId + ); if (localStorage.getItem("parentStudentId") == null) { - var parentStudentsId = response.data.data.students[0].classId; - var classId = response.data.data.students[0]._id; + parentStudentsId = response.data.data.students[0].classId; + classId = response.data.data.students[0]._id; } if (localStorage.getItem("parentStudentId")) { - var parentStudentsId = localStorage.getItem("parentStudentId"); - var classId = localStorage.getItem("parentClassId"); + parentStudentsId = localStorage.getItem("parentStudentId"); + classId = localStorage.getItem("parentClassId"); } - this.getCourses(parentStudentsId, classId); - this.getAnnoucementes(classId); + this.showLoader = false; }) .catch(err => { console.log("err====>", err); this.showLoader = false; }); + await this.getCourses(parentStudentsId, classId); + await this.getAnnoucementes(classId); }, async getCourses(parentStudentsId, classId) { /* getStudentCourses - to get courseData - defined in GetApis.js*/ @@ -954,10 +957,10 @@ export default { this.showLoader = false; }); }, - getMeetingEventes() { + async getMeetingEventes() { if (this.role == "TEACHER") { this.showLoader = true; - http() + await http() .get("/getMeetingEventesList", { headers: { Authorization: "Bearer " + this.token @@ -989,6 +992,10 @@ export default { mounted() { // = this.$store.state.schoolToken; // console.log("this.$store.state.role", this.token); + // this.getUsersList(); + }, + + async created() { if (this.$store.state.role === "ADMIN") { this.token = this.$store.state.token; } else if (this.$store.state.schoolRole === "SUPERADMIN") { @@ -1005,20 +1012,17 @@ export default { this.role = this.$store.state.role; // console.log("role", this.$store.state.schoolRole,"tt",this.$store.state.schoolToken); // this.getData(); - this.getStudents(); - this.getTeachers(); - this.getParents(); - this.getClasses(); - this.getNoticeData(); - this.getUserData(); - this.getFeesAndCollectionsData(); - this.getExpensesData(); - this.getparentStudents(); - this.getMeetingEventes(); - // this.getUsersList(); - }, + await this.getStudents(); + await this.getTeachers(); + await this.getParents(); + await this.getClasses(); + await this.getNoticeData(); + await this.getUserData(); + await this.getFeesAndCollectionsData(); + await this.getExpensesData(); + await this.getparentStudents(); + await this.getMeetingEventes(); - async created() { /* get Latest events list for student login*/ if (this.$store.state.role != "TEACHER") { let response = await this.studentMeetingEvents({ diff --git a/src/pages/changeStudents/changeStudents.vue b/src/pages/changeStudents/changeStudents.vue index e67e55c..9761450 100644 --- a/src/pages/changeStudents/changeStudents.vue +++ b/src/pages/changeStudents/changeStudents.vue @@ -55,7 +55,7 @@ export default { text: "", loading: false, valid: false, - changeStudent: {}, + changeStudent: "", studentsData: [] }; }, @@ -75,6 +75,8 @@ export default { .then(response => { // console.log("resssssss", response.data.data.students[0].classId); this.studentsData = response.data.data.students; + this.changeStudent = response.data.data.students[0]._id; + localStorage.setItem("parentStudentId", this.changeStudent); localStorage.setItem( "parentClassId", response.data.data.students[0].classId