18874: Add 'services/workbench2/' from commit 'f6f88d9ca9cdeeeebfadcfe999789bfb9f69e5c6'
[arvados.git] / services / workbench2 / src / store / banner / banner-action.ts
diff --git a/services/workbench2/src/store/banner/banner-action.ts b/services/workbench2/src/store/banner/banner-action.ts
new file mode 100644 (file)
index 0000000..808ca82
--- /dev/null
@@ -0,0 +1,29 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { Dispatch } from "redux";
+import { RootState } from "store/store";
+import { unionize, UnionOf } from 'common/unionize';
+
+export const bannerReducerActions = unionize({
+    OPEN_BANNER: {},
+    CLOSE_BANNER: {},
+});
+
+export type BannerAction = UnionOf<typeof bannerReducerActions>;
+
+export const openBanner = () =>
+    async (dispatch: Dispatch, getState: () => RootState) => {
+        dispatch(bannerReducerActions.OPEN_BANNER());
+    };
+
+export const closeBanner = () =>
+    async (dispatch: Dispatch<any>, getState: () => RootState) => {
+        dispatch(bannerReducerActions.CLOSE_BANNER());
+    };
+
+export default {
+    openBanner,
+    closeBanner
+};