← full-stack-fastapi-template / frontend/src/hooks/useCustomToast.ts
| 1 | import { toast } from "sonner" |
| 2 | |
| 3 | const useCustomToast = () => { |
| 4 | const showSuccessToast = (description: string) => { |
| 5 | toast.success("Success!", { |
| 6 | description, |
| 7 | }) |
| 8 | } |
| 9 | |
| 10 | const showErrorToast = (description: string) => { |
| 11 | toast.error("Something went wrong!", { |
| 12 | description, |
| 13 | }) |
| 14 | } |
| 15 | |
| 16 | return { showSuccessToast, showErrorToast } |
| 17 | } |
| 18 | |
| 19 | export default useCustomToast |
| 20 |