Commit 1702e00af4c77eb683df4313192398ece58c78f9

Authored by Shikha Mishra

Merge branch 'master' of http://git.viithiisys.com/viithiisys/school-management-dashboard

src/Services/http.js
1 1 import axios from 'axios'
2 2 import store from '@/store/store'
  3 +import Vue from 'vue'
  4 +import {vm1} from "@/main.js"
3 5  
4 6 const baseDomain = "https://api-dashboard.intrack.in/v1";
5 7  
... ... @@ -13,12 +15,59 @@ const baseURL = `${baseDomain}`;
13 15  
14 16 // console.log("role",`${store.state.schoolRole}`);
15 17 // console.log("token",`${store.state.schoolToken}`);
  18 +
16 19 export default () => {
17   - return axios.create({
18   - // baseURL: 'http://192.168.2.221:3002/v1',
19   - baseURL,
  20 + // return axios.create({
  21 + // // baseURL: 'http://192.168.2.221:3002/v1',
  22 + // baseURL,
  23 + // headers: {
  24 + // Authorization: `Bearer ${store.state.token}`
  25 + // }
  26 + // })
  27 + let instance = axios.create({
  28 + // LIVE
  29 + //baseURL: 'https://annadata.patanjaliayurved.org/api',
  30 + // DEVELOPMENT
  31 + baseURL: baseURL,
  32 +
20 33 headers: {
21   - Authorization: `Bearer ${store.state.token}`
  34 + Authorization: `Bearer ${store.state.token}`,
  35 + // 'Access-Control-Allow-Origin': '*'
  36 +
  37 + }
  38 + })
  39 +
  40 + instance.interceptors.request.use((config) => {
  41 + // Do something before request is sent
  42 +
  43 + return config
  44 + }, error => {
  45 + return Promise.reject(error)
  46 + })
  47 + instance.interceptors.response.use((response) => {
  48 + // do something with the response data
  49 +
  50 +
  51 + return response;
  52 + }, error => {
  53 + // handle the response error
  54 + console.log("error in interceptor - ",error.response.status)
  55 + var customError
  56 + const errorNo = error.response.status
  57 +
  58 + switch (errorNo) {
  59 + case 401:
  60 + customError = "Session expired"
  61 + console.log("what is this - ", vm1)
  62 + vm1.$store.dispatch("setToken", null);
  63 + vm1.$router.replace({ path: "/" });
  64 +
  65 + vm1.$store.dispatch("Id", null);
  66 +
  67 + break;
22 68 }
23 69 })
  70 + // response parse
  71 +
  72 + return instance;
24 73 }
25 74 \ No newline at end of file
... ...
... ... @@ -86,7 +86,7 @@ Vue.use(Vuetify, {
86 86  
87 87  
88 88 /* eslint-disable no-new */
89   -new Vue({
  89 +export var vm1 = new Vue({
90 90 el: '#app',
91 91 router,
92 92 store,
... ...
src/pages/Dashboard/LiveOnlineClass.vue
... ... @@ -71,12 +71,7 @@
71 71 <!-- JOIN OR END SESSION -->
72 72 <v-flex>
73 73 <div>
74   - <v-btn
75   - round
76   - class="open-dialog-button"
77   - dark
78   - @click="startChat()"
79   - >Start Session</v-btn>
  74 + <v-btn round class="open-dialog-button" dark @click="startChat()">Start Session</v-btn>
80 75 </div>
81 76 </v-flex>
82 77 <v-flex id="teacherClone">
... ... @@ -165,15 +160,20 @@ export default {
165 160 };
166 161 },
167 162 methods: {
168   - startChat() {
  163 + async startChat() {
169 164 if (this.$store.state.role === "PARENT") {
170 165 let div = document.getElementById("jitsi-container");
171 166 var parent = div.parentNode;
172 167 var clone = div.cloneNode(true);
173 168 clone.id = "jitsi-container";
174   - parent.replaceChild(clone, div);
175   - // div.replaceWith(input.val('').clone(true));
176   - this.studentClasses();
  169 + div.replaceWith(clone);
  170 + console.log("ara ra raraa")
  171 + if(this.counter == 0){
  172 + this.counter +=1
  173 + }else{
  174 + await this.studentClasses();
  175 + }
  176 + this.startConference();
177 177 }
178 178 if (this.$store.state.role === "TEACHER") {
179 179 let div = document.getElementById("jitsi-container");
... ... @@ -309,6 +309,14 @@ export default {
309 309 console.log("response getLiveClassesesList- ", response);
310 310  
311 311 /* CHECK RESPONSE TO ASSIGN MESSAGE INSIDE BUTTON */
  312 + if (response.data.data[0].sessionStatus == "ENDED") {
  313 + // this.startLiveSession = "Start Session";
  314 + this.studentBtn = "";
  315 + }
  316 + if (response.data.data[0].sessionStatus == "STARTED") {
  317 + // this.startLiveSession = "Join Session";
  318 + this.studentBtn = "Join Session";
  319 + }
312 320 if (response.data.data.length == 0) {
313 321 this.startLiveSession = "Start Session";
314 322 this.studentBtn = "";
... ... @@ -334,18 +342,9 @@ export default {
334 342 if (this_.room != null || this_.room != "") {
335 343 this.room = this.room;
336 344 }
337   - this.startConference();
  345 + // this.startConference();
338 346 }
339 347 }
340   -
341   - if (response.data.data[0].sessionStatus == "ENDED") {
342   - // this.startLiveSession = "Start Session";
343   - this.studentBtn = "";
344   - }
345   - if (response.data.data[0].sessionStatus == "STARTED") {
346   - // this.startLiveSession = "Join Session";
347   - this.studentBtn = "Join Session";
348   - }
349 348 }
350 349 },
351 350 },
... ... @@ -355,7 +354,7 @@ export default {
355 354 },
356 355 async created() {
357 356 if (this.$store.state.role === "PARENT") {
358   - this.studentClasses();
  357 + await this.studentClasses();
359 358 }
360 359  
361 360 /* getStudentCourses - to get courseData - defined in GetApis.js*/
... ...
src/pages/Dashboard/dashboard.vue
... ... @@ -752,11 +752,11 @@ export default {
752 752 .catch(error => {
753 753 // console.log("err====>", err);
754 754 this.showLoader = false;
755   - if (error.response.status === 401) {
756   - this.$router.replace({ path: "/" });
757   - this.$store.dispatch("setToken", null);
758   - this.$store.dispatch("Id", null);
759   - }
  755 + // if (error.response.status === 401) {
  756 + // this.$router.replace({ path: "/" });
  757 + // this.$store.dispatch("setToken", null);
  758 + // this.$store.dispatch("Id", null);
  759 + // }
760 760 });
761 761 },
762 762 getParents() {
... ... @@ -1004,8 +1004,12 @@ export default {
1004 1004 async created() {
1005 1005 if (this.$store.state.role === "ADMIN") {
1006 1006 this.token = this.$store.state.token;
  1007 + await this.getFeesAndCollectionsData();
  1008 + await this.getExpensesData();
1007 1009 } else if (this.$store.state.schoolRole === "SUPERADMIN") {
1008 1010 this.token = this.$store.state.schoolToken;
  1011 + await this.getFeesAndCollectionsData();
  1012 + await this.getExpensesData();
1009 1013 } else if (this.$store.state.role === "TEACHER") {
1010 1014 this.token = this.$store.state.token;
1011 1015 } else if (this.$store.state.role === "ACCOUNTANT") {
... ... @@ -1025,8 +1029,8 @@ export default {
1025 1029 await this.getClasses();
1026 1030 await this.getNoticeData();
1027 1031 await this.getUserData();
1028   - await this.getFeesAndCollectionsData();
1029   - await this.getExpensesData();
  1032 +
  1033 +
1030 1034  
1031 1035 /* get Latest events list for student login*/
1032 1036 if (this.$store.state.role == "PARENT") {
... ...
src/pages/changeStudents/changeStudents.vue
... ... @@ -73,9 +73,19 @@ export default {
73 73 http()
74 74 .get("/parentStudentsList")
75 75 .then(response => {
76   - // console.log("resssssss", response.data.data.students[0].classId);
  76 + console.log("resssssss", response);
  77 + var indexStatusFalse = response.data.data.students.findIndex(student => student.status == false)
  78 + console.log("index - ",indexStatusFalse)
  79 + if(indexStatusFalse != -1){
  80 + response.data.data.students[indexStatusFalse].disabled = true
  81 + }
  82 +
77 83 this.studentsData = response.data.data.students;
78   - this.changeStudent = response.data.data.students[0]._id;
  84 + if(indexStatusFalse ==0 ){
  85 + this.changeStudent = response.data.data.students[1]._id;
  86 + }else{
  87 + this.changeStudent = response.data.data.students[0]._id;
  88 + }
79 89 localStorage.setItem("parentStudentId", this.changeStudent);
80 90 localStorage.setItem(
81 91 "parentClassId",
... ...