2024-03-08 14:58:36 +01:00
|
|
|
import { useCallback } from 'react'
|
|
|
|
import { useToast } from '@chakra-ui/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(
|
|
|
|
(title: string, description: string, status: 'success' | 'error') => {
|
|
|
|
toast({
|
|
|
|
title,
|
|
|
|
description,
|
|
|
|
status,
|
|
|
|
isClosable: true,
|
|
|
|
position: 'bottom-right',
|
|
|
|
})
|
|
|
|
},
|
|
|
|
[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
|