Files
dev-connect/client/src/actions/alert.js
T
2023-06-06 22:28:48 +03:00

10 lines
302 B
JavaScript

import { v4 as uuidv4 } from 'uuid';
import {removeAlert, setAlert } from '../reducers/alert';
export const createAlert = (msg, alertType, timeout = 5000) => dispatch => {
const id = uuidv4();
dispatch(setAlert({ msg, alertType, id }));
setTimeout(() => dispatch(removeAlert(id)), timeout);
};