diff --git a/resources/js/utils/useTimeEntries.ts b/resources/js/utils/useTimeEntries.ts index 1faa6759..c4a461e5 100644 --- a/resources/js/utils/useTimeEntries.ts +++ b/resources/js/utils/useTimeEntries.ts @@ -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 + ); } }