2020-08-06 05:24:20 +01:00
|
|
|
import {
|
|
|
|
TOAST_TYPE_ERROR,
|
|
|
|
TOAST_TYPE_SUCCESS,
|
|
|
|
} from '../constants'
|
|
|
|
|
|
|
|
export const TOAST_SHOW = 'TOAST_SHOW'
|
|
|
|
export const TOAST_DISMISS = 'TOAST_DISMISS'
|
|
|
|
export const TOAST_CLEAR = 'TOAST_CLEAR'
|
|
|
|
|
2020-11-15 18:48:32 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
export const dismissToast = (alert) => ({
|
|
|
|
type: TOAST_DISMISS,
|
|
|
|
alert,
|
|
|
|
})
|
2020-08-06 05:24:20 +01:00
|
|
|
|
2020-11-15 18:48:32 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
export const clearToast = () => ({
|
|
|
|
type: TOAST_CLEAR,
|
|
|
|
})
|
2020-08-06 05:24:20 +01:00
|
|
|
|
2020-11-15 18:48:32 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
export const showToast = (type, message) => ({
|
|
|
|
type: TOAST_SHOW,
|
|
|
|
toastType: type,
|
|
|
|
message,
|
|
|
|
})
|
2020-08-06 05:24:20 +01:00
|
|
|
|
|
|
|
export const showToastError = (message) => {
|
|
|
|
return showToast(TOAST_TYPE_ERROR, message)
|
|
|
|
}
|
|
|
|
|
|
|
|
export const showToastSucess = (message) => {
|
|
|
|
console.log("showToastSucess:", message)
|
|
|
|
return showToast(TOAST_TYPE_SUCCESS, message)
|
|
|
|
}
|