Browse Source

fix(dashboard): Prevent creation of ShippingMethod without calculator/checker

Michael Bromley 2 months ago
parent
commit
705975c77d

+ 7 - 1
packages/dashboard/src/app/routes/_authenticated/_shipping-methods/shipping-methods_.$id.tsx

@@ -121,7 +121,13 @@ function ShippingMethodDetailPage() {
                     <PermissionGuard requires={['UpdateShippingMethod']}>
                         <Button
                             type="submit"
-                            disabled={!form.formState.isDirty || !form.formState.isValid || isPending}
+                            disabled={
+                                !form.formState.isDirty ||
+                                !form.formState.isValid ||
+                                isPending ||
+                                !checker?.code ||
+                                !calculator?.code
+                            }
                         >
                             {creatingNewEntity ? <Trans>Create</Trans> : <Trans>Update</Trans>}
                         </Button>