2024-03-17 17:28:45 +01:00
|
|
|
import { useToast } from "@chakra-ui/react"
|
|
|
|
import { useCallback } from "react"
|
2024-02-26 09:39:09 -05:00
|
|
|
|
|
|
|
const useCustomToast = () => {
|
2024-03-08 14:58:36 +01:00
|
|
|
const toast = useToast()
|
2024-02-26 09:39:09 -05:00
|
|
|
|
2024-03-08 14:58:36 +01:00
|
|
|
const showToast = useCallback(
|
2024-03-17 17:28:45 +01:00
|
|
|
(title: string, description: string, status: "success" | "error") => {
|
2024-03-08 14:58:36 +01:00
|
|
|
toast({
|
|
|
|
title,
|
|
|
|
description,
|
|
|
|
status,
|
|
|
|
isClosable: true,
|
2024-03-17 17:28:45 +01:00
|
|
|
position: "bottom-right",
|
2024-03-08 14:58:36 +01:00
|
|
|
})
|
|
|
|
},
|
|
|
|
[toast],
|
|
|
|
)
|
2024-02-26 09:39:09 -05:00
|
|
|
|
2024-03-08 14:58:36 +01:00
|
|
|
return showToast
|
|
|
|
}
|
2024-02-26 09:39:09 -05:00
|
|
|
|
2024-03-08 14:58:36 +01:00
|
|
|
export default useCustomToast
|