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

No live mode for requests larger than one day.

This commit is contained in:
Ferdinand Mütsch 2019-05-20 20:57:49 +02:00
parent 4d10cfb841
commit f7d2a39a00

View File

@ -54,10 +54,10 @@
<div class="input-container" id="input-container"> <div class="input-container" id="input-container">
<label for="apikey">API Key: </label> <label for="apikey">API Key: </label>
<input type="text" class="apikey-input" id="apikey-input" name="apikey" placeholder="Enter your API key here"> <input type="text" class="apikey-input" id="apikey-input" name="apikey" placeholder="Enter your API key here">
<button onclick="load('day')">Day</button> <button onclick="load('day', true)">Day (live)</button>
<button onclick="load('week')">Week</button> <button onclick="load('week', false)">Week</button>
<button onclick="load('month')">Month</button> <button onclick="load('month', false)">Month</button>
<button onclick="load('year')">Year</button> <button onclick="load('year', false)">Year</button>
</div> </div>
<div class="grid-container" id="grid-container"> <div class="grid-container" id="grid-container">
<div class="header-container"> <div class="header-container">
@ -95,9 +95,9 @@
return hours + ':' + minutes + ':' + seconds; return hours + ':' + minutes + ':' + seconds;
} }
function load(interval) { function load(interval, live) {
let apiKey = document.getElementById('apikey-input').value let apiKey = document.getElementById('apikey-input').value
fetch(`${window.location.href}/api/summary?interval=${interval}&live=true`, { fetch(`${window.location.href}/api/summary?interval=${interval}&live=${live}`, {
method: 'GET', method: 'GET',
headers: { headers: {
'Accept': 'application/json', 'Accept': 'application/json',