18692: Changed logic for snackbar
[arvados-workbench2.git] / src / store / snackbar / snackbar-actions.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { unionize, ofType, UnionOf } from "common/unionize";
6
7 export interface SnackbarMessage {
8     message: string;
9     hideDuration: number;
10     kind: SnackbarKind;
11     link?: string;
12 }
13
14 export enum SnackbarKind {
15     SUCCESS = 1,
16     ERROR = 2,
17     INFO = 3,
18     WARNING = 4
19 }
20
21 export const snackbarActions = unionize({
22     OPEN_SNACKBAR: ofType<{message: string; hideDuration?: number, kind?: SnackbarKind, link?: string}>(),
23     CLOSE_SNACKBAR: ofType<{}|null>(),
24     SHIFT_MESSAGES: ofType<{}>()
25 });
26
27 export type SnackbarAction = UnionOf<typeof snackbarActions>;