@lonelyplanet/dotcom-core
Version:
This package is meant to house some of our more common UI and shared libs across dotcom applications.
26 lines (23 loc) • 471 B
text/typescript
import { handleActions, Reducer } from "redux-actions";
import { TOAST_HIDE, TOAST_SHOW } from "../constants/toast";
const toast = handleActions(
{
[TOAST_SHOW]: (state, action) => ({
...state,
...action.payload,
visible: true,
}),
[TOAST_HIDE]: (state) => ({
...state,
visible: false,
}),
},
{
buttonLabel: "",
message: "",
type: "success",
url: "",
visible: false,
},
);
export default toast;