add partial patches to time entries store after time entry updates to avoid inconsistencies , fixes ST-259

This commit is contained in:
Gregor Vostrak
2024-06-18 13:13:39 +02:00
parent c4757ee8a9
commit 79f914d4b6

View File

@@ -78,7 +78,7 @@ export const useTimeEntriesStore = defineStore('timeEntries', () => {
async function updateTimeEntry(timeEntry: TimeEntry) {
const organizationId = getCurrentOrganizationId();
if (organizationId) {
await handleApiRequestNotifications(
const response = await handleApiRequestNotifications(
() =>
api.updateTimeEntry(timeEntry, {
params: {
@@ -89,6 +89,9 @@ export const useTimeEntriesStore = defineStore('timeEntries', () => {
'Time entry updated successfully',
'Failed to update time entry'
);
timeEntries.value = timeEntries.value.map((entry) =>
entry.id === timeEntry.id ? response.data : entry
);
}
}