Feat: write data on edit
This commit is contained in:
parent
899fd95dbd
commit
5020479b0a
@ -74,10 +74,14 @@ export default {
|
||||
...mapActions('travail', {
|
||||
'createMonth': 'createMonth',
|
||||
}),
|
||||
...mapActions('config', {
|
||||
'writeData': 'writeData',
|
||||
}),
|
||||
save: function () {
|
||||
console.log("save")
|
||||
console.log(this.monthCopy)
|
||||
this.createMonth({date: this.monthDate, month: this.monthCopy})
|
||||
this.writeData()
|
||||
},
|
||||
cancel: function () {
|
||||
this.monthCopy = this.theEmptyMonth
|
||||
|
@ -71,13 +71,14 @@ export default {
|
||||
'updateMonth': 'updateMonth',
|
||||
}),
|
||||
...mapActions('config', {
|
||||
'loadData': 'loadData',
|
||||
'writeData': 'writeData',
|
||||
}),
|
||||
toggleEdit: function () {
|
||||
this.editing = !this.editing
|
||||
},
|
||||
save: function () {
|
||||
this.updateMonth({date: this.TheDate, month: {...this.monthCopy}})
|
||||
this.writeData()
|
||||
this.toggleEdit()
|
||||
},
|
||||
cancel: function () {
|
||||
|
@ -71,6 +71,8 @@ export default {
|
||||
retrocessionMean: "retrocessionMean",
|
||||
})
|
||||
},
|
||||
mounted () {
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
}
|
||||
|
@ -183,11 +183,11 @@ const travail = {
|
||||
},
|
||||
loadMonths (context) {
|
||||
// import all months from storage
|
||||
|
||||
readFile(context.rootGetters["config/dataFilePath"], (err, data) => {
|
||||
if (err) throw err;
|
||||
const months = Papa.parse(data.toString(), {header: true, dynamicTyping:true})
|
||||
.data.reduce(
|
||||
const months = Papa.parse(data.toString(), {header: true, dynamicTyping:true, skipEmptyLines:true})
|
||||
.data
|
||||
.reduce(
|
||||
(acc, el) => {
|
||||
acc[el.date] = el;
|
||||
return acc
|
||||
|
Loading…
Reference in New Issue
Block a user