parent
4f9235c95d
commit
8121e79095
@ -1,41 +0,0 @@
|
||||
<script lang="ts">
|
||||
import axios from 'axios';
|
||||
import { getHours, getMinutes, createTimeObj, getAccumulatedSeconds, formatSeconds } from '../libs/time.js'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
seconds_left_to_practice_today:0,
|
||||
seconds_practiced_today:0,
|
||||
seconds_left_to_get_ahead:0
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
setTimes(response){
|
||||
this.seconds_left_to_practice_today = response.data.seconds_left_to_practice_today
|
||||
this.seconds_practiced_today = response.data.seconds_practiced
|
||||
this.seconds_left_to_get_ahead = response.data.seconds_left_to_get_ahead
|
||||
},
|
||||
refresh(){
|
||||
axios.get(import.meta.env.VITE_PRACTICE_TRACKER_API_URL+'status').then(this.setTimes)
|
||||
},
|
||||
formatSeconds
|
||||
},
|
||||
mounted() {
|
||||
axios.get(import.meta.env.VITE_PRACTICE_TRACKER_API_URL+'status').then(this.setTimes)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<h2 @click="refresh">Time Summary</h2>
|
||||
<h3>Time Left to Practice Today</h3>
|
||||
{{formatSeconds(seconds_left_to_practice_today)}}
|
||||
<h3>Extra Time to Accumulate</h3>
|
||||
{{formatSeconds(seconds_left_to_get_ahead)}}
|
||||
<h3>Time Practiced Today</h3>
|
||||
{{formatSeconds(seconds_practiced_today)}}
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
||||
@ -0,0 +1,21 @@
|
||||
<script setup>
|
||||
import { formatSeconds } from '../libs/time.js'
|
||||
import { onMounted, ref } from 'vue'
|
||||
|
||||
let practiceStatus = ref({})
|
||||
const loadData = async () => {
|
||||
const response = await fetch(import.meta.env.VITE_PRACTICE_TRACKER_API_URL+'status')
|
||||
let data = await response.json()
|
||||
practiceStatus.value = data
|
||||
}
|
||||
onMounted(loadData)
|
||||
</script>
|
||||
<template>
|
||||
<h2 @click="loadData">Practice Status</h2>
|
||||
<h3>Time Left to Practice Today</h3>
|
||||
{{formatSeconds(practiceStatus.seconds_left_to_practice_today)}}
|
||||
<h3>Extra Time to Accumulate</h3>
|
||||
{{formatSeconds(practiceStatus.seconds_left_to_get_ahead)}}
|
||||
<h3>Time Practiced Today</h3>
|
||||
{{formatSeconds(practiceStatus.seconds_practiced)}}
|
||||
</template>
|
||||
Loading…
Reference in new issue