From 396e09f5eb476cdcc74bf0c2b70c21766b75a125 Mon Sep 17 00:00:00 2001 From: Rodrigo Ceccato Date: Thu, 8 Feb 2024 09:25:54 -0300 Subject: [PATCH] Add missing fields to JSON endpoints for read and set --- config.html | 8 +++++++- server.js | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/config.html b/config.html index 460df9d..c0cd5ac 100644 --- a/config.html +++ b/config.html @@ -44,6 +44,9 @@

Configuration Page

+ + + @@ -72,6 +75,7 @@

Configuration Page

document.getElementById('pomosBeforeLongRest').value = data.pomosBeforeLongRest; document.getElementById('shortRestTime').value = data.shortRestTime; document.getElementById('longRestTime').value = data.longRestTime; + document.getElementById('focusTime').value = data.focusTime; document.getElementById('currTime').value = data.currTime; document.getElementById('isResting').checked = data.isResting; document.getElementById('isLongResting').checked = data.isLongResting; @@ -86,11 +90,12 @@

Configuration Page

const shortRestTime = document.getElementById('shortRestTime').value; const longRestTime = document.getElementById('longRestTime').value; const currTime = document.getElementById('currTime').value; + const focusTime = document.getElementById('focusTime').value; const isResting = document.getElementById('isResting').checked; const isLongResting = document.getElementById('isLongResting').checked; const pomoCount = document.getElementById('pomoCount').value; - // Example: Send the values to the server (you might want to use AJAX for this) + // Send the values to the server (you might want to use AJAX for this) fetch('/save-config', { method: 'POST', headers: { @@ -101,6 +106,7 @@

Configuration Page

shortRestTime, longRestTime, currTime, + focusTime, pomoCount, isResting, isLongResting diff --git a/server.js b/server.js index 0cece82..47cf769 100644 --- a/server.js +++ b/server.js @@ -118,6 +118,9 @@ getPomoStateJSON = () => { pomoCount: pomoCount, isResting: isResting, isLongResting: isLongResting, + focusTime: focusTime, + shortRestTime: shortRestTime, + longRestTime: longRestTime, timestamp: new Date().toISOString(), }; };