mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-24 13:53:50 +00:00
22 lines
413 B
TypeScript
22 lines
413 B
TypeScript
import { useToast as uToast, UseToastOptions } from '@chakra-ui/react';
|
|
import { useCallback, useMemo } from 'react';
|
|
|
|
export const useToast = (props?: UseToastOptions) => {
|
|
const toast = uToast({
|
|
position: 'top',
|
|
duration: 2000,
|
|
...props
|
|
});
|
|
|
|
const myToast = useCallback(
|
|
(options?: UseToastOptions) => {
|
|
toast(options);
|
|
},
|
|
[props]
|
|
);
|
|
|
|
return {
|
|
toast: myToast
|
|
};
|
|
};
|