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 {
|
} else {
|
||||||
message.success(compile(onSuccess?.successMessage));
|
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) {
|
} catch (error) {
|
||||||
actionField.data.loading = false;
|
actionField.data.loading = false;
|
||||||
@ -554,6 +561,13 @@ export const useCustomizeUpdateActionProps = () => {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
message.success(compile(onSuccess?.successMessage));
|
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 {
|
} else {
|
||||||
message.success(compile(onSuccess?.successMessage));
|
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() {
|
async onCancel() {
|
||||||
@ -949,6 +970,13 @@ export const useUpdateActionProps = () => {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
message.success(compile(onSuccess?.successMessage));
|
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) {
|
} catch (error) {
|
||||||
actionField.data.loading = false;
|
actionField.data.loading = false;
|
||||||
|
@ -621,7 +621,6 @@ function AfterSuccess() {
|
|||||||
const { dn } = useDesignable();
|
const { dn } = useDesignable();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const fieldSchema = useFieldSchema();
|
const fieldSchema = useFieldSchema();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SchemaSettings.ModalItem
|
<SchemaSettings.ModalItem
|
||||||
title={t('After successful submission')}
|
title={t('After successful submission')}
|
||||||
@ -639,7 +638,6 @@ function AfterSuccess() {
|
|||||||
},
|
},
|
||||||
manualClose: {
|
manualClose: {
|
||||||
title: t('Popup close method'),
|
title: t('Popup close method'),
|
||||||
default: false,
|
|
||||||
enum: [
|
enum: [
|
||||||
{ label: t('Automatic close'), value: false },
|
{ label: t('Automatic close'), value: false },
|
||||||
{ label: t('Manually close'), value: true },
|
{ label: t('Manually close'), value: true },
|
||||||
@ -650,7 +648,6 @@ function AfterSuccess() {
|
|||||||
},
|
},
|
||||||
redirecting: {
|
redirecting: {
|
||||||
title: t('Then'),
|
title: t('Then'),
|
||||||
default: false,
|
|
||||||
enum: [
|
enum: [
|
||||||
{ label: t('Stay on current page'), value: false },
|
{ label: t('Stay on current page'), value: false },
|
||||||
{ label: t('Redirect to'), value: true },
|
{ label: t('Redirect to'), value: true },
|
||||||
|
@ -48,9 +48,7 @@ const useIsAllowToSetDefaultValue = ({ form, fieldSchema, collectionField }: Pro
|
|||||||
const { form: innerForm } = useFormBlockContext();
|
const { form: innerForm } = useFormBlockContext();
|
||||||
const innerFieldSchema = useFieldSchema();
|
const innerFieldSchema = useFieldSchema();
|
||||||
const { type } = useFormBlockType();
|
const { type } = useFormBlockType();
|
||||||
console.log(type);
|
|
||||||
const { isAllowToSetDefaultValue = _isAllowToSetDefaultValue } = useContext(DefaultValueContext) || {};
|
const { isAllowToSetDefaultValue = _isAllowToSetDefaultValue } = useContext(DefaultValueContext) || {};
|
||||||
|
|
||||||
const innerCollectionField =
|
const innerCollectionField =
|
||||||
getField(innerFieldSchema['name']) || getCollectionJoinField(innerFieldSchema['x-collection-field']);
|
getField(innerFieldSchema['name']) || getCollectionJoinField(innerFieldSchema['x-collection-field']);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user