mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 13:03:50 +00:00
V4.7-alpha (#985)
Co-authored-by: heheer <71265218+newfish-cmyk@users.noreply.github.com>
This commit is contained in:
@@ -1,13 +1,21 @@
|
||||
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 && props)
|
||||
...props
|
||||
});
|
||||
|
||||
const myToast = useCallback(
|
||||
(options?: UseToastOptions) => {
|
||||
toast(options);
|
||||
},
|
||||
[props]
|
||||
);
|
||||
|
||||
return {
|
||||
toast
|
||||
toast: myToast
|
||||
};
|
||||
};
|
||||
|
Reference in New Issue
Block a user