| 1 |
/** |
| 2 |
* Utils functions |
| 3 |
* |
| 4 |
* @param url |
| 5 |
* @param data |
| 6 |
* @param functions |
| 7 |
* @since 4.3.0 |
| 8 |
* @version 1.0.0 |
| 9 |
*/ |
| 10 |
import Toastify from 'toastify-js'; |
| 11 |
import 'toastify-js/src/toastify.css'; |
| 12 |
|
| 13 |
const argsToastify = { |
| 14 |
text: '', |
| 15 |
gravity: lpData.toast.gravity, // `top` or `bottom` |
| 16 |
position: lpData.toast.position, // `left`, `center` or `right` |
| 17 |
className: `${ lpData.toast.classPrefix }`, |
| 18 |
close: lpData.toast.close == 1, |
| 19 |
stopOnFocus: lpData.toast.stopOnFocus == 1, |
| 20 |
duration: lpData.toast.duration, |
| 21 |
}; |
| 22 |
export const show = ( message, status = 'success', argsCustom ) => { |
| 23 |
let args = argsToastify; |
| 24 |
if ( argsCustom ) { |
| 25 |
args = { ...args, ...argsCustom }; |
| 26 |
} |
| 27 |
|
| 28 |
const toastify = new Toastify( { |
| 29 |
...args, |
| 30 |
text: message, |
| 31 |
className: `${ lpData.toast.classPrefix } ${ status }`, |
| 32 |
} ); |
| 33 |
toastify.showToast(); |
| 34 |
}; |
| 35 |
|