mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-15 20:33:47 +00:00
feat: allow dissolving a block
This commit is contained in:
@@ -25,6 +25,7 @@ import {
|
||||
ReorderEntry,
|
||||
requestApplyDelay,
|
||||
requestDeleteAll,
|
||||
requestDissolveBlock,
|
||||
requestEventSwap,
|
||||
SwapEntry,
|
||||
} from '../api/rundown';
|
||||
@@ -514,6 +515,28 @@ export const useEntryActions = () => {
|
||||
[_applyDelayMutation],
|
||||
);
|
||||
|
||||
/**
|
||||
* Calls mutation to dissolve a block
|
||||
* @private
|
||||
*/
|
||||
const _dissolveBlockMutation = useMutation({
|
||||
mutationFn: requestDissolveBlock,
|
||||
onSettled: () => queryClient.invalidateQueries({ queryKey: RUNDOWN }),
|
||||
});
|
||||
|
||||
/**
|
||||
* Deletes a block and moves its events to the top level
|
||||
*/
|
||||
const dissolveBlock = useCallback(
|
||||
async (blockId: EntryId) => {
|
||||
try {
|
||||
await _dissolveBlockMutation.mutateAsync(blockId);
|
||||
} catch (error) {
|
||||
logAxiosError('Error dissolving block', error);
|
||||
}
|
||||
},
|
||||
[_dissolveBlockMutation],
|
||||
);
|
||||
/**
|
||||
* Calls mutation to reorder an entry
|
||||
* @private
|
||||
@@ -663,6 +686,7 @@ export const useEntryActions = () => {
|
||||
batchUpdateEvents,
|
||||
deleteEntry,
|
||||
deleteAllEntries,
|
||||
dissolveBlock,
|
||||
getEntryById,
|
||||
reorderEntry,
|
||||
swapEvents,
|
||||
|
||||
Reference in New Issue
Block a user