added variable for the update-interval
This commit is contained in:
@@ -71,6 +71,9 @@ import { onMounted, ref } from 'vue'
|
|||||||
import type { Packages } from '@/types/Packages'
|
import type { Packages } from '@/types/Packages'
|
||||||
import { Package } from '@/types/Package'
|
import { Package } from '@/types/Package'
|
||||||
|
|
||||||
|
// This variable sets the update-interval
|
||||||
|
const updateIntervalInMinutes = 5
|
||||||
|
|
||||||
const lastUpdatedTime = ref(0)
|
const lastUpdatedTime = ref(0)
|
||||||
const lastUpdatedSeconds = ref(0)
|
const lastUpdatedSeconds = ref(0)
|
||||||
const rtf = new Intl.RelativeTimeFormat('en', {
|
const rtf = new Intl.RelativeTimeFormat('en', {
|
||||||
@@ -174,14 +177,17 @@ onMounted(() => {
|
|||||||
lastUpdatedSeconds.value = Math.floor((Date.now() - lastUpdatedTime.value) / 1000)
|
lastUpdatedSeconds.value = Math.floor((Date.now() - lastUpdatedTime.value) / 1000)
|
||||||
}, 1000)
|
}, 1000)
|
||||||
|
|
||||||
const interval = setInterval(() => {
|
const interval = setInterval(
|
||||||
getTotalPackages()
|
() => {
|
||||||
getBuiltPackages()
|
getTotalPackages()
|
||||||
getBuildingPackages()
|
getBuiltPackages()
|
||||||
getQueuedPackages()
|
getBuildingPackages()
|
||||||
lastUpdatedTime.value = Date.now()
|
getQueuedPackages()
|
||||||
lastUpdatedSeconds.value = Math.floor((Date.now() - lastUpdatedTime.value) / 1000)
|
lastUpdatedTime.value = Date.now()
|
||||||
}, 120_000)
|
lastUpdatedSeconds.value = Math.floor((Date.now() - lastUpdatedTime.value) / 1000)
|
||||||
|
},
|
||||||
|
updateIntervalInMinutes * 60 * 1000
|
||||||
|
)
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user