f20aea9f3c867535b1fe94b7e62c13e734b720beR334">334
+      // Login successful.
335
+      refIsLogin.value = true
336
+    }catch(error) {
337
+      console.log(error);
338
+      formError.value = error.response.data.non_field_errors.join("\n");
339
+    }
340
+    // Validate token with server and create new session
341
+  })
342
+  .catch(error => {
343
+    // Handle error
344
+  });
345
+}
263 346
 </script>

+ 19 - 6
src/views/Tab1Page.vue

@@ -61,7 +61,7 @@
61 61
 <script setup lang="ts">
62 62
 
63 63
   import { IonPage, IonHeader, IonToolbar, IonTitle, IonContent, IonIcon, onIonViewWillEnter, IonButton, 
64
-  onIonViewWillLeave, IonItem, IonLabel, IonThumbnail, IonCol, IonGrid, IonRow, IonCard, IonCardContent, IonCardHeader, IonCardSubtitle, IonCardTitle, onIonViewDidEnter,  IonButtons, IonImg } from '@ionic/vue';
64
+  onIonViewWillLeave, IonItem, IonLabel, IonThumbnail, IonCol, IonGrid, IonRow, IonCard, IonCardContent, IonCardHeader, IonCardSubtitle, IonCardTitle, onIonViewDidEnter,  IonButtons, IonImg, useIonRouter } from '@ionic/vue';
65 65
 
66 66
 import ExploreContainer  from '@/components/ExploreContainer.vue';
67 67
 import CourseSchedule from '@/components/CourseSchedule.vue'
@@ -72,7 +72,7 @@ import SearchEngine from '@/components/SearchEngine.vue'
72 72
 import { CapacitorHttp } from '@capacitor/core';
73 73
 import { ref } from 'vue';
74 74
 import { TOKEN, getProducts, setToken, getObject, getToken, getTrainers, listMats, storeAPNToken,
75
-getTodayProgs, getLive, getPosts, initAPI} from '@/composable/settings';
75
+getTodayProgs, getLive, getPosts, initAPI, clearPref, isLogin} from '@/composable/settings';
76 76
 //import VueCoreVideoPlayer from 'vue-core-video-player'
77 77
 import { vueVimeoPlayer } from 'vue-vimeo-player'
78 78
 
@@ -105,6 +105,8 @@ const scrollToBottom = () => {
105 105
 };
106 106
 const items = ref([{msg: 'foo'}, {msg: 'bar2'}])
107 107
 
108
+const ionRouter = useIonRouter();
109
+
108 110
 const options = {
109 111
       id: 59777392,
110 112
       width: 640,
@@ -117,6 +119,11 @@ const options = {
117 119
 const liveObj = ref()
118 120
 const modules =  [Autoplay, Keyboard, Pagination, Scrollbar, Zoom]
119 121
   onIonViewWillEnter(async () => {
122
+    let v = await isLogin()
123
+    console.log("v === ", v)
124
+    if( v == false ) {
125
+      ionRouter.navigate('/tabs/tab4', 'forward', 'replace');
126
+    }
120 127
     //console.log("video " ,video)
121 128
     //console.log("video id", video.value.id)
122 129
     //const player = new Player(video.value.id, options);
@@ -134,9 +141,15 @@ const modules =  [Autoplay, Keyboard, Pagination, Scrollbar, Zoom]
134 141
     //console.log('u ', u)
135 142
     await initAPI()
136 143
     token.value = await getToken()
137
-    getTrainers().then( (data) => {
138
-      trainers.value = data
139
-    })
144
+    
145
+    try{
146
+      trainers.value = await getTrainers()
147
+    }catch(error){
148
+      console.log("trainers ", error)
149
+      await clearPref()
150
+      token.value = await getToken()
151
+    }
152
+
140 153
     listMats().then( (data) => {
141 154
       mats.value = data
142 155
     })
@@ -157,7 +170,7 @@ const modules =  [Autoplay, Keyboard, Pagination, Scrollbar, Zoom]
157 170
       if( liveObj.value == null ||  liveObj.value.result == false ) {
158 171
         liveObj.value = await getLive()
159 172
       }
160
-    }, 10000)
173
+    }, 100000)
161 174
   })
162 175
 
163 176
   onIonViewWillLeave(() => {

+ 10 - 2
src/views/Tab2Page.vue

@@ -31,16 +31,24 @@
31 31
 </template>
32 32
 
33 33
 <script setup lang="ts">
34
-import { IonPage, IonHeader, IonToolbar, IonTitle, IonContent, IonGrid, IonRow, IonCol, onIonViewWillEnter, IonProgressBar, IonIcon, IonButtons, IonButton} from '@ionic/vue';
34
+import { IonPage, IonHeader, IonToolbar, IonTitle, IonContent, IonGrid, IonRow, IonCol, onIonViewWillEnter, IonProgressBar, IonIcon, IonButtons, IonButton, useIonRouter} from '@ionic/vue';
35 35
 import { search } from 'ionicons/icons';
36 36
 
37 37
 import Course from '@/components/Course.vue';
38 38
 import { ref } from 'vue';
39 39
 
40
-import {listCourses} from '@/composable/settings';
40
+import {listCourses, isLogin} from '@/composable/settings';
41 41
 const courses = ref([]);
42 42
 const processing = ref(false);
43
+const ionRouter = useIonRouter();
44
+
43 45
 onIonViewWillEnter(async () => {
46
+  let v = await isLogin()
47
+  console.log("v === ", v)
48
+  if( v == false ) {
49
+    ionRouter.navigate('/tabs/tab4', 'forward', 'replace');
50
+  }
51
+
44 52
   processing.value = true;
45 53
   courses.value = await listCourses()
46 54
   processing.value = false;

+ 8 - 2
src/views/Tab3Page.vue

@@ -81,13 +81,13 @@
81 81
 
82 82
 <script setup lang="ts">
83 83
 import { IonPage, IonHeader, IonToolbar, IonTitle, IonContent, IonIcon, IonSegment, IonSegmentButton, onIonViewWillEnter, IonGrid, 
84
-IonRow, IonCol, IonButton, IonButtons } from '@ionic/vue';
84
+IonRow, IonCol, IonButton, IonButtons, useIonRouter } from '@ionic/vue';
85 85
 import { home, heart, pin, star, call, globe, basket, barbell, trash, person, search } from 'ionicons/icons';
86 86
 import ExploreContainer from '@/components/ExploreContainer.vue';
87 87
 import CourseSchedule from '@/components/CourseSchedule.vue';
88 88
 import { ref } from 'vue';
89 89
 
90
-import { getTodayProgs } from '@/composable/settings';
90
+import { getTodayProgs, isLogin } from '@/composable/settings';
91 91
 
92 92
 const today = ref()
93 93
 const weekday = ["sun","mon","tue","wed","thu","fri","sat"];
@@ -98,10 +98,16 @@ const thu = ref()
98 98
 const fri = ref()
99 99
 const sat = ref()
100 100
 const sun = ref()
101
+const ionRouter = useIonRouter();
101 102
 
102 103
 onIonViewWillEnter( async () => {
103 104
   const d = new Date();
104 105
   console.log(" d ", d.getDay())
106
+  let v = await isLogin()
107
+  console.log("v === ", v)
108
+  if( v == false ) {
109
+    ionRouter.navigate('/tabs/tab4', 'forward', 'replace');
110
+  }
105 111
   today.value = weekday[d.getDay()];
106 112
   mon.value = await getTodayProgs("mon")
107 113
   tue.value = await getTodayProgs("tue")

+ 7 - 1
src/views/TabsPage.vue

@@ -27,7 +27,13 @@
27 27
 </template>
28 28
 
29 29
 <script setup lang="ts">
30
-import { IonTabBar, IonTabButton, IonTabs, IonLabel, IonIcon, IonPage, IonRouterOutlet } from '@ionic/vue';
30
+import { IonTabBar, IonTabButton, IonTabs, IonLabel, IonIcon, IonPage, IonRouterOutlet, onIonViewWillEnter, useIonRouter } from '@ionic/vue';
31 31
 import { ellipse, square, triangle, person, time, videocam, grid } from 'ionicons/icons';
32
+import { isLogin } from '@/composable/settings';
32 33
 
34
+const ionRouter = useIonRouter();
35
+
36
+onIonViewWillEnter(async () => {
37
+  console.log("tabs init ...")
38
+})
33 39
 </script>

tum/whitesports - Gogs: Simplico Git Service

1 İşlemeler (master)

Yazar SHA1 Mesaj Tarih
  Tum d01d7cf85d first commit 4 yıl önce