28 lines
		
	
	
		
			608 B
		
	
	
	
		
			JavaScript
		
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			608 B
		
	
	
	
		
			JavaScript
		
	
	
	
| import Toastify from 'toastify-js';
 | |
| import 'toastify-js/src/toastify.css';
 | |
| 
 | |
| const defaultToast = {
 | |
|     duration: 3000,
 | |
|     gravity: 'bottom', // `top` or `bottom`
 | |
|     position: 'right', // `left`, `center` or `right`
 | |
|     style: {
 | |
|         background: 'none',
 | |
|     },
 | |
| };
 | |
| 
 | |
| export function success(message) {
 | |
|     Toastify({
 | |
|         ...defaultToast,
 | |
|         text: message,
 | |
|         className: '!bg-green-700 !text-green-100',
 | |
|     }).showToast();
 | |
| }
 | |
| 
 | |
| export function error(message) {
 | |
|     Toastify({
 | |
|         ...defaultToast,
 | |
|         text: message,
 | |
|         className: '!bg-red-700 !text-red-100',
 | |
|     }).showToast();
 | |
| }
 |