mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 13:20:31 +00:00
fix(webapp): remove duplicated form submitting
This commit is contained in:
@@ -18,7 +18,7 @@ export default function ItemFormFloatingActions({ onCancel }) {
|
||||
const { setSubmitPayload, isNewMode } = useItemFormContext();
|
||||
|
||||
// Formik context.
|
||||
const { isSubmitting } = useFormikContext();
|
||||
const { isSubmitting, submitForm } = useFormikContext();
|
||||
|
||||
// Handle cancel button click.
|
||||
const handleCancelBtnClick = (event) => {
|
||||
@@ -33,6 +33,7 @@ export default function ItemFormFloatingActions({ onCancel }) {
|
||||
// Handle submit & new button click.
|
||||
const handleSubmitAndNewBtnClick = (event) => {
|
||||
setSubmitPayload({ redirect: false });
|
||||
submitForm();
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -52,7 +53,6 @@ export default function ItemFormFloatingActions({ onCancel }) {
|
||||
className={classNames('ml1', 'btn--submit-new')}
|
||||
disabled={isSubmitting}
|
||||
onClick={handleSubmitAndNewBtnClick}
|
||||
type="submit"
|
||||
>
|
||||
<T id={'save_new'} />
|
||||
</Button>
|
||||
@@ -84,4 +84,4 @@ export default function ItemFormFloatingActions({ onCancel }) {
|
||||
|
||||
const SaveButton = styled(Button)`
|
||||
min-width: 100px;
|
||||
`;
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user