1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { SnackbarAction, snackbarActions } from "./snackbar-actions";
7 export interface SnackbarState {
13 const DEFAULT_HIDE_DURATION = 3000;
15 const initialState: SnackbarState = {
18 hideDuration: DEFAULT_HIDE_DURATION
21 export const snackbarReducer = (state = initialState, action: SnackbarAction) => {
22 return snackbarActions.match(action, {
23 OPEN_SNACKBAR: data => ({ ...initialState, ...data, open: true }),
24 CLOSE_SNACKBAR: () => initialState,