Browse Source

Fixed onSubmit to onClick

Taichi Masuyama 4 năm trước cách đây
mục cha
commit
a3612f630b

+ 3 - 1
packages/app/src/components/PrivateLegacyPages.tsx

@@ -148,7 +148,7 @@ const ConvertByPathModal = React.memo((props: ConvertByPathModalProps): JSX.Elem
         <input type="text" className="form-control" placeholder="/" value={currentInput} onChange={e => setInput(e.target.value)} />
         <input type="text" className="form-control" placeholder="/" value={currentInput} onChange={e => setInput(e.target.value)} />
       </ModalBody>
       </ModalBody>
       <ModalFooter>
       <ModalFooter>
-        <button type="button" className="btn btn-primary" onSubmit={(e) => { e.preventDefault(); props.onSubmit?.(currentInput) }}>
+        <button type="button" className="btn btn-primary" onClick={() => props.onSubmit?.(currentInput)}>
           <i className="icon-fw icon-refresh" aria-hidden="true"></i>
           <i className="icon-fw icon-refresh" aria-hidden="true"></i>
           { t('private_legacy_pages.by_path_modal.button_label') }
           { t('private_legacy_pages.by_path_modal.button_label') }
         </button>
         </button>
@@ -318,6 +318,7 @@ const PrivateLegacyPages = (props: Props): JSX.Element => {
         </div>
         </div>
         <div className="d-flex pl-md-2">
         <div className="d-flex pl-md-2">
           <button type="button" className="btn btn-light" onClick={() => setOpenConvertModal(true)}>
           <button type="button" className="btn btn-light" onClick={() => setOpenConvertModal(true)}>
+            {/* TODO: i18n */}
             Input the path to convert
             Input the path to convert
           </button>
           </button>
         </div>
         </div>
@@ -396,6 +397,7 @@ const PrivateLegacyPages = (props: Props): JSX.Element => {
               convertPath,
               convertPath,
             });
             });
             toastSuccess(t('private_legacy_pages.by_path_modal.success'));
             toastSuccess(t('private_legacy_pages.by_path_modal.success'));
+            setOpenConvertModal(false);
           }
           }
           catch {
           catch {
             toastError(t('private_legacy_pages.by_path_modal.error'));
             toastError(t('private_legacy_pages.by_path_modal.error'));