19675: Merge branch '19675-instance-types-panel' from arvados-workbench2.git
[arvados.git] / services / workbench2 / src / store / dialog / dialog-reducer.ts
index 30368685064dfe6f9837d7c20d0cc4808b0cbf01..548d0a7897f99ba48a27c9826bf02bc18ad8d9ca 100644 (file)
@@ -2,7 +2,7 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import { DialogAction, dialogActions } from "./dialog-actions";
+import { DialogAction, dialogActions } from './dialog-actions';
 
 export type DialogState = Record<string, Dialog<any>>;
 
@@ -12,16 +12,14 @@ export interface Dialog<T> {
 }
 
 export const dialogReducer = (state: DialogState = {}, action: DialogAction) =>
-
     dialogActions.match(action, {
         OPEN_DIALOG: ({ id, data }) => ({ ...state, [id]: { open: true, data } }),
         CLOSE_DIALOG: ({ id }) => ({
             ...state,
-            [id]: state[id] ? { ...state[id], open: false } : { open: false, data: {} }
+            [id]: state[id] ? { ...state[id], open: false } : { open: false, data: {} },
         }),
-        CLOSE_ALL_DIALOGS: () => ({ }),
+        CLOSE_ALL_DIALOGS: () => ({}),
         default: () => state,
     });
 
-export const getDialog = <T>(state: DialogState, id: string) =>
-    state[id] ? state[id] as Dialog<T> : undefined;
+export const getDialog = <T>(state: DialogState, id: string) => (state[id] ? (state[id] as Dialog<T>) : undefined);