blob: 7426096d32ed1645cbd944eb317dde0b53bd57f8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
import { useState } from "react";
const useAlert = () => {
const [message, setMessage] = useState("");
const [type, setType] = useState("");
const showAlert = (message, type = "success") => {
setMessage(message);
setType(type);
setTimeout(() => {
setMessage("");
setType("");
window.location.reload();
}, 5000);
};
return { message, type, showAlert };
};
export default useAlert;
|