浏览代码

axios cache

tum 2 年之前
父节点
当前提交
20403252dc
共有 8 个文件被更改,包括 268 次插入37 次删除
  1. 98 0
      package-lock.json
  2. 2 0
      package.json
  3. 8 3
      src/components/CourseMat.vue
  4. 5 2
      src/components/Post.vue
  5. 28 12
      src/composable/settings.ts
  6. 2 2
      src/views/CourseDetailPage.vue
  7. 22 8
      src/views/Tab1Page.vue
  8. 103 10
      src/views/Tab3Page.vue

+ 98 - 0
package-lock.json

@@ -23,6 +23,8 @@
23 23
         "@ionic/vue-router": "^7.5.4",
24 24
         "@vimeo/player": "^2.20.1",
25 25
         "axios": "^1.6.0",
26
+        "axios-cache-interceptor": "^1.3.2",
27
+        "axios-extensions": "^3.1.6",
26 28
         "ionicons": "^7.0.0",
27 29
         "marked": "^10.0.0",
28 30
         "moment": "^2.29.4",
@@ -3904,6 +3906,46 @@
3904 3906
         "proxy-from-env": "^1.1.0"
3905 3907
       }
3906 3908
     },
3909
+    "node_modules/axios-cache-interceptor": {
3910
+      "version": "1.3.2",
3911
+      "resolved": "https://registry.npmjs.org/axios-cache-interceptor/-/axios-cache-interceptor-1.3.2.tgz",
3912
+      "integrity": "sha512-FNy4/IKvFYVswpPS09j3H9OUzcXSuxQ93wYxCKnogHbjCRE9nDQ/lukgjyuJqMIk3Yao51qQI/zPbMRNQu4JJw==",
3913
+      "dependencies": {
3914
+        "cache-parser": "^1.2.4",
3915
+        "fast-defer": "^1.1.7",
3916
+        "object-code": "^1.3.0"
3917
+      },
3918
+      "engines": {
3919
+        "node": ">=12"
3920
+      },
3921
+      "funding": {
3922
+        "url": "https://github.com/arthurfiorette/axios-cache-interceptor?sponsor=1"
3923
+      },
3924
+      "peerDependencies": {
3925
+        "axios": "^1"
3926
+      }
3927
+    },
3928
+    "node_modules/axios-extensions": {
3929
+      "version": "3.1.6",
3930
+      "resolved": "https://registry.npmjs.org/axios-extensions/-/axios-extensions-3.1.6.tgz",
3931
+      "integrity": "sha512-CmwMYxxAw4DcQDJ7/2Iv4GJj1Ao48lJEPieycgZQH6m1KcYZqf9zm2HM/CsULqheCpYxZbiGrCfZf5tVjXqoLg==",
3932
+      "dependencies": {
3933
+        "lru-cache": "^7.14.0",
3934
+        "tslib": "^2.1.0",
3935
+        "util": "^0.12.3"
3936
+      },
3937
+      "peerDependencies": {
3938
+        "axios": "*"
3939
+      }
3940
+    },
3941
+    "node_modules/axios-extensions/node_modules/lru-cache": {
3942
+      "version": "7.18.3",
3943
+      "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz",
3944
+      "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==",
3945
+      "engines": {
3946
+        "node": ">=12"
3947
+      }
3948
+    },
3907 3949
     "node_modules/axios/node_modules/form-data": {
3908 3950
       "version": "4.0.0",
3909 3951
       "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
@@ -4136,6 +4178,11 @@
4136 4178
         "node": ">=8"
4137 4179
       }
4138 4180
     },
4181
+    "node_modules/cache-parser": {
4182
+      "version": "1.2.4",
4183
+      "resolved": "https://registry.npmjs.org/cache-parser/-/cache-parser-1.2.4.tgz",
4184
+      "integrity": "sha512-O0KwuHuJnbHUrghHi2kGp0SxnWSIBXTYt7M8WVhW0kbPRUNUKoE/Of6e1rRD6AAxmfxFunKnt90yEK09D+sc5g=="
4185
+    },
4139 4186
     "node_modules/cachedir": {
4140 4187
       "version": "2.4.0",
4141 4188
       "resolved": "https://registry.npmjs.org/cachedir/-/cachedir-2.4.0.tgz",
@@ -5691,6 +5738,11 @@
5691 5738
       "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
5692 5739
       "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
5693 5740
     },
5741
+    "node_modules/fast-defer": {
5742
+      "version": "1.1.8",
5743
+      "resolved": "https://registry.npmjs.org/fast-defer/-/fast-defer-1.1.8.tgz",
5744
+      "integrity": "sha512-lEJeOH5VL5R09j6AA0D4Uvq7AgsHw0dAImQQ+F3iSyHZuAxyQfWobsagGpTcOPvJr3urmKRHrs+Gs9hV+/Qm/Q=="
5745
+    },
5694 5746
     "node_modules/fast-glob": {
5695 5747
       "version": "3.3.1",
5696 5748
       "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz",
@@ -6437,6 +6489,21 @@
6437 6489
         "@stencil/core": "^4.0.3"
6438 6490
       }
6439 6491
     },
6492
+    "node_modules/is-arguments": {
6493
+      "version": "1.1.1",
6494
+      "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz",
6495
+      "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==",
6496
+      "dependencies": {
6497
+        "call-bind": "^1.0.2",
6498
+        "has-tostringtag": "^1.0.0"
6499
+      },
6500
+      "engines": {
6501
+        "node": ">= 0.4"
6502
+      },
6503
+      "funding": {
6504
+        "url": "https://github.com/sponsors/ljharb"
6505
+      }
6506
+    },
6440 6507
     "node_modules/is-array-buffer": {
6441 6508
       "version": "3.0.2",
6442 6509
       "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.2.tgz",
@@ -6556,6 +6623,20 @@
6556 6623
         "node": ">=8"
6557 6624
       }
6558 6625
     },
6626
+    "node_modules/is-generator-function": {
6627
+      "version": "1.0.10",
6628
+      "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz",
6629
+      "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==",
6630
+      "dependencies": {
6631
+        "has-tostringtag": "^1.0.0"
6632
+      },
6633
+      "engines": {
6634
+        "node": ">= 0.4"
6635
+      },
6636
+      "funding": {
6637
+        "url": "https://github.com/sponsors/ljharb"
6638
+      }
6639
+    },
6559 6640
     "node_modules/is-glob": {
6560 6641
       "version": "4.0.3",
6561 6642
       "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
@@ -7564,6 +7645,11 @@
7564 7645
       "integrity": "sha512-ub5E4+FBPKwAZx0UwIQOjYWGHTEq5sPqHQNRN8Z9e4A7u3Tj1weLJsL59yH9vmvqEtBHaOmT6cYQKIZOxp35FQ==",
7565 7646
       "dev": true
7566 7647
     },
7648
+    "node_modules/object-code": {
7649
+      "version": "1.3.0",
7650
+      "resolved": "https://registry.npmjs.org/object-code/-/object-code-1.3.0.tgz",
7651
+      "integrity": "sha512-PLplgvzuFhSPBuTX/mtaXEnU3c6g7qKflVVQbV9VWEnV/34iKeAX1jeDNCKq1OgGlsnkA/NjldCzTbHxa7Wj4A=="
7652
+    },
7567 7653
     "node_modules/object-inspect": {
7568 7654
       "version": "1.13.1",
7569 7655
       "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz",
@@ -9299,6 +9385,18 @@
9299 9385
         "requires-port": "^1.0.0"
9300 9386
       }
9301 9387
     },
9388
+    "node_modules/util": {
9389
+      "version": "0.12.5",
9390
+      "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz",
9391
+      "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==",
9392
+      "dependencies": {
9393
+        "inherits": "^2.0.3",
9394
+        "is-arguments": "^1.0.4",
9395
+        "is-generator-function": "^1.0.7",
9396
+        "is-typed-array": "^1.1.3",
9397
+        "which-typed-array": "^1.1.2"
9398
+      }
9399
+    },
9302 9400
     "node_modules/util-deprecate": {
9303 9401
       "version": "1.0.2",
9304 9402
       "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",

+ 2 - 0
package.json

@@ -27,6 +27,8 @@
27 27
     "@ionic/vue-router": "^7.5.4",
28 28
     "@vimeo/player": "^2.20.1",
29 29
     "axios": "^1.6.0",
30
+    "axios-cache-interceptor": "^1.3.2",
31
+    "axios-extensions": "^3.1.6",
30 32
     "ionicons": "^7.0.0",
31 33
     "marked": "^10.0.0",
32 34
     "moment": "^2.29.4",

+ 8 - 3
src/components/CourseMat.vue

@@ -1,6 +1,6 @@
1 1
 <template>
2 2
   <ion-card :router-link="'/tabs/mat_detail/'+obj.id">
3
-    <img alt="Silhouette of mountains" :src="thmb"  v-if="thmb" />
3
+    <ion-img alt="Silhouette of mountains" :src="thmb"  v-if="thmb" style='width:100%' />
4 4
     <ion-card-header>
5 5
       <ion-card-title>{{ name }}</ion-card-title>
6 6
     </ion-card-header>
@@ -12,7 +12,7 @@
12 12
 </template>
13 13
 
14 14
 <script setup lang="ts">
15
-  import { IonPage, IonHeader, IonToolbar, IonTitle, IonContent, IonIcon, onIonViewWillEnter, IonCard, IonCardHeader, IonCardTitle, IonCardSubtitle, IonCardContent } from '@ionic/vue';
15
+  import { IonPage, IonHeader, IonToolbar, IonTitle, IonContent, IonIcon, onIonViewWillEnter, IonCard, IonCardHeader, IonCardTitle, IonCardSubtitle, IonCardContent, IonImg } from '@ionic/vue';
16 16
   import moment from 'moment'
17 17
 import { getTrainers, listCourses } from '@/composable/settings';
18 18
   import { ref, onMounted  } from 'vue'
@@ -34,7 +34,12 @@ import { getTrainers, listCourses } from '@/composable/settings';
34 34
     dt.value = moment(temp).format('LLL'); 
35 35
 
36 36
     if( obj.gifs && obj.gifs.length > 0 ) {
37
-      thmb.value = obj.gifs[0].sizes[2].link
37
+      console.log(obj.gifs)
38
+      if(obj.gifs[0].sizes.length > 2 ) {
39
+        thmb.value = obj.gifs[0].sizes[2].link
40
+      }else {
41
+        thmb.value = obj.gifs[0].sizes[0].link
42
+      }
38 43
     }else {
39 44
       thmb.value = obj.course_image
40 45
     }

+ 5 - 2
src/components/Post.vue

@@ -1,6 +1,6 @@
1 1
 <template>
2
-  <ion-card :router-link="'/tabs/post_detail/'+obj.id">
3
-    <img alt="Silhouette of mountains" :src="feature_img"  v-if="feature_img" />
2
+  <ion-card :router-link="'/tabs/post_detail/'+obj.id" >
3
+    <img alt="Silhouette of mountains" :src="feature_img"  v-if="feature_img" class='img-crop'/>
4 4
     <ion-card-header>
5 5
       <ion-card-title>{{ obj.name }}</ion-card-title>
6 6
     </ion-card-header>
@@ -37,4 +37,7 @@ import { getTrainers, listCourses, BASE_URL } from '@/composable/settings';
37 37
 ion-card-title {
38 38
   font-size:1em;
39 39
 }
40
+.img-crop {
41
+   aspect-ratio: 4/3 auto;
42
+}
40 43
 </style>

+ 28 - 12
src/composable/settings.ts

@@ -1,12 +1,18 @@
1 1
 import { CapacitorHttp } from '@capacitor/core';
2
-import axios from "axios";
2
+import Axios from "axios";
3
+import { setupCache } from 'axios-cache-interceptor';
4
+
3 5
 
4 6
 import { Preferences } from '@capacitor/preferences';
5 7
 
6 8
 
7 9
 export const TOKEN = '173cb9e357a861abd91e8008fab9246e0cc116af'
8 10
 //export const BASE_URL = 'http://192.168.1.35:8020/'
9
-export const BASE_URL = 'http://localhost:8020/'
11
+//export const BASE_URL = 'http://localhost:8020/'
12
+export const BASE_URL = 'https://www.tigermuaythai.live/'
13
+
14
+const axios = setupCache(Axios); 
15
+
10 16
 export const getProducts = async () => {
11 17
   console.log("Get Products")
12 18
   const { data } = await axios.get("https://yesno.wtf/api");
@@ -78,7 +84,7 @@ export const listCourses = async  () => {
78 84
 
79 85
   const token = await Preferences.get({ key: 'token' });
80 86
   console.log("token = ", token)
81
-  const { data } = await axios.get(BASE_URL + "backend/api/courses/?limit=1000&ordering=-id&status=active", {
87
+  const { data } = await axios.get(BASE_URL + "backend/api/courses/?ordering=-id&status=active", {
82 88
     headers: { 
83 89
     'Authorization': `Token ${token.value}`
84 90
     }
@@ -129,7 +135,7 @@ export const storeAPNToken = async (device_token) => {
129 135
 export const listCourseMats = async  (cid) => {
130 136
   const token = await Preferences.get({ key: 'token' });
131 137
   console.log("token = ", token)
132
-  const { data } = await axios.get(BASE_URL + "backend/api/courses/"+cid+"/mats/?limit=100", {
138
+  const { data } = await axios.get(BASE_URL + "backend/api/courses/"+cid+"/mats/", {
133 139
     headers: { 
134 140
     'Authorization': `Token ${token.value}`
135 141
     }
@@ -137,16 +143,26 @@ export const listCourseMats = async  (cid) => {
137 143
   console.log(data)
138 144
   return data
139 145
 }
140
-export const getTodayProgs = async  () => {
146
+export const getTodayProgs = async  (day=null) => {
141 147
   const token = await Preferences.get({ key: 'token' });
142 148
   console.log("token = ", token)
143
-  const { data } = await axios.get(BASE_URL + "backend/api/courses/today_progs/", {
144
-    headers: { 
145
-    'Authorization': `Token ${token.value}`
146
-    }
147
-  })
148
-  console.log(data)
149
-  return data
149
+  if(day) {
150
+    const { data } = await axios.get(BASE_URL + `backend/api/courses/today_progs/?day=${day}`, {
151
+      headers: { 
152
+      'Authorization': `Token ${token.value}`
153
+      }
154
+    })
155
+    console.log(data)
156
+    return data
157
+  }else {
158
+    const { data } = await axios.get(BASE_URL + "backend/api/courses/today_progs/", {
159
+      headers: { 
160
+      'Authorization': `Token ${token.value}`
161
+      }
162
+    })
163
+    console.log(data)
164
+    return data
165
+  }
150 166
 }
151 167
 export const getLive = async  () => {
152 168
   const token = await Preferences.get({ key: 'token' });

+ 2 - 2
src/views/CourseDetailPage.vue

@@ -42,7 +42,7 @@ const { id } = route.params;
42 42
 const mats = ref([])
43 43
 const course = ref()
44 44
 onIonViewWillEnter(async () => {
45
-  course.value = await getCourse(id)
46
-  mats.value = await listCourseMats(id)
45
+  getCourse(id).then( (data) => course.value = data )
46
+  listCourseMats(id).then( (data) => mats.value = data )
47 47
 })
48 48
 </script>

+ 22 - 8
src/views/Tab1Page.vue

@@ -30,15 +30,15 @@
30 30
       <template v-if="posts">
31 31
         <div class='ion-padding'>
32 32
           <h2>Muaythai Techniques</h2>
33
-          <swiper :slides-per-view="2"  :loop="true"  class='ion-no-margin'>
34
-          <swiper-slide v-for="m in posts">
33
+          <swiper :slides-per-view="2"  :loop="true"  class='ion-no-margin' id="post_slide">
34
+          <swiper-slide v-for="m in posts" class='ion-no-padding'>
35 35
             <Post :obj="m" />
36 36
           </swiper-slide>
37 37
           </swiper>
38 38
         </div>
39 39
       </template>
40 40
       <template v-if="mats">
41
-        <h2>Trainings</h2>
41
+        <h2 class='ion-padding-start'>Trainings</h2>
42 42
       <ion-grid>
43 43
 
44 44
         <ion-row>
@@ -151,16 +151,24 @@ const modules =  [Autoplay, Keyboard, Pagination, Scrollbar, Zoom]
151 151
     //console.log('u ', u)
152 152
 
153 153
     token.value = await getToken()
154
-    trainers.value = await getTrainers()
155
-    mats.value = await listMats()
156
-    posts.value = await getPosts("muaythai-techniques")
154
+    getTrainers().then( (data) => {
155
+      trainers.value = data
156
+    })
157
+    listMats().then( (data) => {
158
+      mats.value = data
159
+    })
160
+    getPosts("muaythai-techniques").then( (data) => {
161
+      posts.value = data   
162
+    })
157 163
     console.log(" trainers => ", trainers)
158 164
 
159 165
     GoogleAuth.initialize();
160 166
     registerNotifications()
161 167
     addListeners()
162 168
 
163
-    todays.value = await getTodayProgs()
169
+    getTodayProgs().then( (data) => {
170
+      todays.value = data
171
+    })
164 172
   })
165 173
 
166 174
   onIonViewWillLeave(() => {
@@ -175,7 +183,7 @@ const liveObj = ref()
175 183
       if( liveObj.value == null ||  liveObj.value.result == false ) {
176 184
         liveObj.value = await getLive()
177 185
       }
178
-    }, 1000)
186
+    }, 10000)
179 187
   })
180 188
 
181 189
   const doGet = async () => {
@@ -227,3 +235,9 @@ const getDeliveredNotifications = async () => {
227 235
   console.log('delivered notifications', notificationList);
228 236
 }
229 237
 </script>
238
+
239
+<style scoped>
240
+#post_slide {
241
+   aspect-ratio: 16/9 auto;
242
+}
243
+</style>

+ 103 - 10
src/views/Tab3Page.vue

@@ -2,22 +2,115 @@
2 2
   <ion-page>
3 3
     <ion-header>
4 4
       <ion-toolbar>
5
-        <ion-title>Tab 3</ion-title>
5
+        <ion-title>Schedule</ion-title>
6 6
       </ion-toolbar>
7 7
     </ion-header>
8
-    <ion-content :fullscreen="true">
9
-      <ion-header collapse="condense">
10
-        <ion-toolbar>
11
-          <ion-title size="large">Tab 3</ion-title>
12
-        </ion-toolbar>
13
-      </ion-header>
14
-
15
-      <ExploreContainer name="Tab 3 page" />
8
+    <ion-content>
9
+      <div class='ion-padding' v-if="today">
10
+      <ion-segment :scrollable="true" :value="today">
11
+        <ion-segment-button value="mon" @click="changeDay($event)">
12
+          Mon
13
+        </ion-segment-button>
14
+        <ion-segment-button value="tue" @click="changeDay($event)">
15
+          Tue
16
+        </ion-segment-button>
17
+        <ion-segment-button value="wed" @click="changeDay($event)">
18
+          Wed
19
+        </ion-segment-button>
20
+        <ion-segment-button value="thu" @click="changeDay($event)">
21
+          Thu
22
+        </ion-segment-button>
23
+        <ion-segment-button value="fri" @click="changeDay($event)">
24
+          Fri
25
+        </ion-segment-button>
26
+        <ion-segment-button value="sat" @click="changeDay($event)">
27
+          Sat
28
+        </ion-segment-button>
29
+        <ion-segment-button value="sun" @click="changeDay($event)">
30
+          Sun
31
+        </ion-segment-button>
32
+      </ion-segment>
33
+      </div>
34
+      <ion-grid> 
35
+        <ion-row>
36
+      <template v-if="today == 'mon'">
37
+        <ion-col size="12" size-md="4" v-for="c in mon">
38
+          <CourseSchedule :course-obj="c.course_level.course" :from-time="c.from_time" :to-time="c.to_time" class='ion-no-margin ion-margin-bottom' />
39
+        </ion-col> 
40
+      </template>
41
+      <template v-if="today == 'tue'">
42
+        <ion-col size="12" size-md="4" v-for="c in tue">
43
+          <CourseSchedule :course-obj="c.course_level.course" :from-time="c.from_time" :to-time="c.to_time" class='ion-no-margin ion-margin-bottom' />
44
+        </ion-col> 
45
+      </template>
46
+      <template v-if="today == 'wed'">
47
+        <ion-col size="12" size-md="4" v-for="c in wed">
48
+          <CourseSchedule :course-obj="c.course_level.course" :from-time="c.from_time" :to-time="c.to_time" class='ion-no-margin ion-margin-bottom' />
49
+        </ion-col> 
50
+      </template>
51
+      <template v-if="today == 'thu'">
52
+        <ion-col size="12" size-md="4" v-for="c in thu">
53
+          <CourseSchedule :course-obj="c.course_level.course" :from-time="c.from_time" :to-time="c.to_time" class='ion-no-margin ion-margin-bottom' />
54
+        </ion-col> 
55
+      </template>
56
+      <template v-if="today == 'fri'">
57
+        <ion-col size="12" size-md="4" v-for="c in fri">
58
+          <CourseSchedule :course-obj="c.course_level.course" :from-time="c.from_time" :to-time="c.to_time" class='ion-no-margin ion-margin-bottom' />
59
+        </ion-col> 
60
+      </template>
61
+      <template v-if="today == 'sat'">
62
+        <ion-col size="12" size-md="4" v-for="c in sat">
63
+          <CourseSchedule :course-obj="c.course_level.course" :from-time="c.from_time" :to-time="c.to_time" class='ion-no-margin ion-margin-bottom' />
64
+        </ion-col> 
65
+      </template>
66
+      <template v-if="today == 'sun'">
67
+        <ion-col size="12" size-md="4" v-for="c in sun">
68
+          <CourseSchedule :course-obj="c.course_level.course" :from-time="c.from_time" :to-time="c.to_time" class='ion-no-margin ion-margin-bottom' />
69
+        </ion-col> 
70
+      </template>
71
+        </ion-row>
72
+      </ion-grid>
16 73
     </ion-content>
17 74
   </ion-page>
18 75
 </template>
19 76
 
20 77
 <script setup lang="ts">
21
-import { IonPage, IonHeader, IonToolbar, IonTitle, IonContent } from '@ionic/vue';
78
+import { IonPage, IonHeader, IonToolbar, IonTitle, IonContent, IonIcon, IonSegment, IonSegmentButton, onIonViewWillEnter, IonGrid, 
79
+IonRow, IonCol } from '@ionic/vue';
80
+import { home, heart, pin, star, call, globe, basket, barbell, trash, person } from 'ionicons/icons';
22 81
 import ExploreContainer from '@/components/ExploreContainer.vue';
82
+import CourseSchedule from '@/components/CourseSchedule.vue';
83
+import { ref } from 'vue';
84
+
85
+import { getTodayProgs } from '@/composable/settings';
86
+
87
+const today = ref()
88
+const weekday = ["sun","mon","tue","wed","thu","fri","sat"];
89
+const mon = ref()
90
+const tue = ref()
91
+const wed = ref()
92
+const thu = ref()
93
+const fri = ref()
94
+const sat = ref()
95
+const sun = ref()
96
+
97
+onIonViewWillEnter( async () => {
98
+  const d = new Date();
99
+  console.log(" d ", d.getDay())
100
+  today.value = weekday[d.getDay()];
101
+  mon.value = await getTodayProgs("mon")
102
+  tue.value = await getTodayProgs("tue")
103
+  wed.value = await getTodayProgs("wed")
104
+  thu.value = await getTodayProgs("thu")
105
+  fri.value = await getTodayProgs("fri")
106
+  sat.value = await getTodayProgs("sat")
107
+  sun.value = await getTodayProgs("sun")
108
+
109
+  
110
+  //today.value = 'mon';
111
+})
112
+
113
+const changeDay = (e) => {
114
+  today.value = e.target.value
115
+}
23 116
 </script>