@@ -9,22 +9,23 @@ import tw from 'twin.macro';
99import Button from '@/components/elements/Button' ;
1010import useServer from '@/plugins/useServer' ;
1111import useFileManagerSwr from '@/plugins/useFileManagerSwr' ;
12- import withFlash , { WithFlashProps } from '@/hoc/withFlash ' ;
12+ import useFlash from '@/plugins/useFlash ' ;
1313
1414interface FormikValues {
1515 name : string ;
1616}
1717
18- type OwnProps = WithFlashProps & RequiredModalProps & { files : string [ ] ; useMoveTerminology ?: boolean } ;
18+ type OwnProps = RequiredModalProps & { files : string [ ] ; useMoveTerminology ?: boolean } ;
1919
20- const RenameFileModal = ( { flash , files, useMoveTerminology, ...props } : OwnProps ) => {
20+ const RenameFileModal = ( { files, useMoveTerminology, ...props } : OwnProps ) => {
2121 const { uuid } = useServer ( ) ;
2222 const { mutate } = useFileManagerSwr ( ) ;
23+ const { clearFlashes, clearAndAddHttpError } = useFlash ( ) ;
2324 const directory = ServerContext . useStoreState ( state => state . files . directory ) ;
2425 const setSelectedFiles = ServerContext . useStoreActions ( actions => actions . files . setSelectedFiles ) ;
2526
2627 const submit = ( { name } : FormikValues , { setSubmitting } : FormikHelpers < FormikValues > ) => {
27- flash . clearFlashes ( 'files' ) ;
28+ clearFlashes ( 'files' ) ;
2829
2930 const len = name . split ( '/' ) . length ;
3031 if ( files . length === 1 ) {
@@ -50,7 +51,7 @@ const RenameFileModal = ({ flash, files, useMoveTerminology, ...props }: OwnProp
5051 . catch ( error => {
5152 mutate ( ) ;
5253 setSubmitting ( false ) ;
53- flash . clearAndAddHttpError ( { key : 'files' , error } ) ;
54+ clearAndAddHttpError ( { key : 'files' , error } ) ;
5455 } )
5556 . then ( ( ) => props . onDismissed ( ) ) ;
5657 } ;
@@ -96,4 +97,4 @@ const RenameFileModal = ({ flash, files, useMoveTerminology, ...props }: OwnProp
9697 ) ;
9798} ;
9899
99- export default withFlash ( RenameFileModal ) ;
100+ export default RenameFileModal ;
0 commit comments