1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00
wakapi/static/assets/js/components/summary.js

16 lines
567 B
JavaScript

PetiteVue.createApp({
$delimiters: ['${', '}'],
get currentInterval() {
const urlParams = new URLSearchParams(window.location.search)
const cookies = new URLSearchParams(document.cookie.replaceAll('; ', '&'))
if (urlParams.has('interval'))
return urlParams.get('interval')
if (cookies.has('wakapi_summary_interval'))
return cookies.get('wakapi_summary_interval')
if (!urlParams.has('from') && !urlParams.has('to'))
return 'today'
return null
}
}).mount('#summary-page')