fix: after successful submission failed to config redirectTo (#2867)
This commit is contained in:
parent
18543f40e7
commit
0e9ab35254
@ -245,6 +245,13 @@ export const useCreateActionProps = () => {
|
||||
});
|
||||
} else {
|
||||
message.success(compile(onSuccess?.successMessage));
|
||||
if (onSuccess?.redirecting && onSuccess?.redirectTo) {
|
||||
if (isURL(onSuccess.redirectTo)) {
|
||||
window.location.href = onSuccess.redirectTo;
|
||||
} else {
|
||||
navigate(onSuccess.redirectTo);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
actionField.data.loading = false;
|
||||
@ -554,6 +561,13 @@ export const useCustomizeUpdateActionProps = () => {
|
||||
});
|
||||
} else {
|
||||
message.success(compile(onSuccess?.successMessage));
|
||||
if (onSuccess?.redirecting && onSuccess?.redirectTo) {
|
||||
if (isURL(onSuccess.redirectTo)) {
|
||||
window.location.href = onSuccess.redirectTo;
|
||||
} else {
|
||||
navigate(onSuccess.redirectTo);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
@ -658,6 +672,13 @@ export const useCustomizeBulkUpdateActionProps = () => {
|
||||
});
|
||||
} else {
|
||||
message.success(compile(onSuccess?.successMessage));
|
||||
if (onSuccess?.redirecting && onSuccess?.redirectTo) {
|
||||
if (isURL(onSuccess.redirectTo)) {
|
||||
window.location.href = onSuccess.redirectTo;
|
||||
} else {
|
||||
navigate(onSuccess.redirectTo);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
async onCancel() {
|
||||
@ -949,6 +970,13 @@ export const useUpdateActionProps = () => {
|
||||
});
|
||||
} else {
|
||||
message.success(compile(onSuccess?.successMessage));
|
||||
if (onSuccess?.redirecting && onSuccess?.redirectTo) {
|
||||
if (isURL(onSuccess.redirectTo)) {
|
||||
window.location.href = onSuccess.redirectTo;
|
||||
} else {
|
||||
navigate(onSuccess.redirectTo);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
actionField.data.loading = false;
|
||||
|
@ -621,7 +621,6 @@ function AfterSuccess() {
|
||||
const { dn } = useDesignable();
|
||||
const { t } = useTranslation();
|
||||
const fieldSchema = useFieldSchema();
|
||||
|
||||
return (
|
||||
<SchemaSettings.ModalItem
|
||||
title={t('After successful submission')}
|
||||
@ -639,7 +638,6 @@ function AfterSuccess() {
|
||||
},
|
||||
manualClose: {
|
||||
title: t('Popup close method'),
|
||||
default: false,
|
||||
enum: [
|
||||
{ label: t('Automatic close'), value: false },
|
||||
{ label: t('Manually close'), value: true },
|
||||
@ -650,7 +648,6 @@ function AfterSuccess() {
|
||||
},
|
||||
redirecting: {
|
||||
title: t('Then'),
|
||||
default: false,
|
||||
enum: [
|
||||
{ label: t('Stay on current page'), value: false },
|
||||
{ label: t('Redirect to'), value: true },
|
||||
|
@ -48,9 +48,7 @@ const useIsAllowToSetDefaultValue = ({ form, fieldSchema, collectionField }: Pro
|
||||
const { form: innerForm } = useFormBlockContext();
|
||||
const innerFieldSchema = useFieldSchema();
|
||||
const { type } = useFormBlockType();
|
||||
console.log(type);
|
||||
const { isAllowToSetDefaultValue = _isAllowToSetDefaultValue } = useContext(DefaultValueContext) || {};
|
||||
|
||||
const innerCollectionField =
|
||||
getField(innerFieldSchema['name']) || getCollectionJoinField(innerFieldSchema['x-collection-field']);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user