UNPKG

@lonelyplanet/dotcom-core

Version:

This package is meant to house some of our more common UI and shared libs across dotcom applications.

46 lines (37 loc) 981 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var redux_actions_1 = require("redux-actions"); var toast_1 = require("../constants/toast"); var showToast = redux_actions_1.createAction(toast_1.TOAST_SHOW, function (message, type, buttonLabel, url) { return { buttonLabel: buttonLabel, message: message, type: type, url: url }; }); var hideToast = redux_actions_1.createAction(toast_1.TOAST_HIDE); exports.showToastMessage = function (message, type, buttonLabel, url) { if (type === void 0) { type = "success"; } if (buttonLabel === void 0) { buttonLabel = ""; } if (url === void 0) { url = ""; } return function (dispatch) { dispatch(showToast(message, type, buttonLabel, url)); setTimeout(function () { return dispatch(hideToast()); }, toast_1.TOAST_DURATION); }; }; exports.hideToastMessage = function () { return function (dispatch) { dispatch(hideToast()); }; };