Files
fast_api_template/frontend/src/hooks/useCustomToast.ts
T
2024-03-08 18:23:54 +00:00

24 lines
460 B
TypeScript

import { useCallback } from 'react'
import { useToast } from '@chakra-ui/react'
const useCustomToast = () => {
const toast = useToast()
const showToast = useCallback(
(title: string, description: string, status: 'success' | 'error') => {
toast({
title,
description,
status,
isClosable: true,
position: 'bottom-right',
})
},
[toast],
)
return showToast
}
export default useCustomToast