Fixed overwriting records bug

This commit is contained in:
Maximilian Giller 2021-01-03 21:42:29 +01:00
parent bc9e51d199
commit 64ba600a8f

View file

@ -112,7 +112,7 @@ export const juggl = {
return true; return true;
}); });
}, },
loadRecords({ commit, state }, { limit, finished }) { loadRecords({ commit, state, getters }, { limit, finished }) {
if (limit !== undefined) { if (limit !== undefined) {
commit("setRecordsLimit", limit); commit("setRecordsLimit", limit);
} }
@ -120,7 +120,15 @@ export const juggl = {
var payload = { limit: state.recordsLimit, finished: finished }; var payload = { limit: state.recordsLimit, finished: finished };
return jugglService.getRecords(payload).then(r => { return jugglService.getRecords(payload).then(r => {
commit("setRecords", r.data.records); var allRecords = Object.values(r.data.records);
if (finished === true) {
allRecords = [...allRecords, ...getters.runningRecords];
} else if (finished === false) {
allRecords = [...allRecords, ...getters.finishedRecords];
}
commit("setRecords", allRecords);
}); });
}, },
loadRunningRecords({ commit, getters }) { loadRunningRecords({ commit, getters }) {