diff --git a/public/index.html b/public/index.html
index 74b54f9..719f244 100644
--- a/public/index.html
+++ b/public/index.html
@@ -192,14 +192,14 @@
diff --git a/public/js/db.js b/public/js/db.js
index 67ead7c..f46959f 100644
--- a/public/js/db.js
+++ b/public/js/db.js
@@ -4,7 +4,8 @@ const db = new Dexie('fast');
db.version(1).stores({
catalog: '++id, value, type, target',
- entries: '++id, day, type'
+ entries: '++id, day, type',
+ weight: 'date'
});
db.open().catch(function (err) {
diff --git a/public/js/index.js b/public/js/index.js
index b32ce60..85ebc02 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -182,8 +182,17 @@ Litedom({
async forward() {
await this.setDate(+1);
},
- addWeight() {
- console.log('add weight');
+ addWeight(e) {
+ // capture weight entry
+ let weight = document.getElementById('weight');
+
+ db.weight.put({
+ date: Date.parse(this.data.current.day),
+ value: Number(weight.value)
+ }).then(() => {
+ // update
+ this.setDate(0);
+ });
},
created() {
// start service worker