mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-16 12:53:32 +00:00
refactor: improve return of reorder
This commit is contained in:
committed by
Carlos Valente
parent
1ee773a426
commit
8232e64cc6
@@ -549,6 +549,22 @@ export const useEntryActions = () => {
|
||||
onError: (_error, _data, context) => {
|
||||
queryClient.setQueryData<Rundown>(RUNDOWN, context?.previousData);
|
||||
},
|
||||
|
||||
// Mutation finished, we update the rundown with the response
|
||||
onSuccess: (response) => {
|
||||
if (response.data) {
|
||||
const { id, title, order, flatOrder, entries, revision } = response.data;
|
||||
queryClient.setQueryData<Rundown>(RUNDOWN, {
|
||||
id,
|
||||
title,
|
||||
order,
|
||||
flatOrder,
|
||||
entries,
|
||||
revision,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// Mutation finished, failed or successful
|
||||
// Fetch anyway, just to be sure
|
||||
onSettled: () => {
|
||||
|
||||
Reference in New Issue
Block a user