mirror of
https://github.com/strapi/strapi.git
synced 2025-10-12 08:36:40 +00:00
remove onblur
Signed-off-by: Virginie Ky <virginie.ky@gmail.com>
This commit is contained in:
parent
8b4886515c
commit
bfe0cf321e
@ -19,7 +19,6 @@ function Inputs({
|
|||||||
label,
|
label,
|
||||||
name,
|
name,
|
||||||
onChange,
|
onChange,
|
||||||
onBlur,
|
|
||||||
onClick,
|
onClick,
|
||||||
onRemove,
|
onRemove,
|
||||||
type,
|
type,
|
||||||
@ -34,7 +33,6 @@ function Inputs({
|
|||||||
<HeadersInput
|
<HeadersInput
|
||||||
errors={customError}
|
errors={customError}
|
||||||
name={name}
|
name={name}
|
||||||
onBlur={onBlur}
|
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
onRemove={onRemove}
|
onRemove={onRemove}
|
||||||
@ -77,7 +75,6 @@ function Inputs({
|
|||||||
onChange={e => {
|
onChange={e => {
|
||||||
handleChange(e);
|
handleChange(e);
|
||||||
}}
|
}}
|
||||||
onBlur={onBlur}
|
|
||||||
value={value}
|
value={value}
|
||||||
/>
|
/>
|
||||||
{hasError && <ErrorMessage>{error}</ErrorMessage>}
|
{hasError && <ErrorMessage>{error}</ErrorMessage>}
|
||||||
@ -106,7 +103,6 @@ Inputs.propTypes = {
|
|||||||
customError: PropTypes.object,
|
customError: PropTypes.object,
|
||||||
label: PropTypes.string,
|
label: PropTypes.string,
|
||||||
name: PropTypes.string.isRequired,
|
name: PropTypes.string.isRequired,
|
||||||
onBlur: PropTypes.func.isRequired,
|
|
||||||
onChange: PropTypes.func.isRequired,
|
onChange: PropTypes.func.isRequired,
|
||||||
onClick: PropTypes.func,
|
onClick: PropTypes.func,
|
||||||
onRemove: PropTypes.func,
|
onRemove: PropTypes.func,
|
||||||
|
@ -188,7 +188,7 @@ function EditView() {
|
|||||||
|
|
||||||
if (isMounted.current) {
|
if (isMounted.current) {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: 'DATA_SUBMITTED',
|
type: 'SUBMIT_SUCCEEDED',
|
||||||
});
|
});
|
||||||
|
|
||||||
strapi.notification.success(`Settings.webhooks.created`);
|
strapi.notification.success(`Settings.webhooks.created`);
|
||||||
@ -213,12 +213,6 @@ function EditView() {
|
|||||||
|
|
||||||
const goBack = () => push('/settings/webhooks');
|
const goBack = () => push('/settings/webhooks');
|
||||||
|
|
||||||
const handleBlur = () => {
|
|
||||||
if (submittedOnce) {
|
|
||||||
checkFormErrors();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleChange = ({ target: { name, value } }) => {
|
const handleChange = ({ target: { name, value } }) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: 'ON_CHANGE',
|
type: 'ON_CHANGE',
|
||||||
@ -351,7 +345,7 @@ function EditView() {
|
|||||||
|
|
||||||
if (isMounted.current) {
|
if (isMounted.current) {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: 'DATA_SUBMITTED',
|
type: 'SUBMIT_SUCCEEDED',
|
||||||
});
|
});
|
||||||
strapi.notification.success('notification.form.success.fields');
|
strapi.notification.success('notification.form.success.fields');
|
||||||
}
|
}
|
||||||
@ -393,7 +387,6 @@ function EditView() {
|
|||||||
})}
|
})}
|
||||||
error={getErrorMessage(get(formErrors, key, null))}
|
error={getErrorMessage(get(formErrors, key, null))}
|
||||||
name={key}
|
name={key}
|
||||||
onBlur={handleBlur}
|
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
validations={form[key].validations}
|
validations={form[key].validations}
|
||||||
value={modifiedData[key] || form[key].value}
|
value={modifiedData[key] || form[key].value}
|
||||||
|
@ -24,8 +24,6 @@ const reducer = (state, action) => {
|
|||||||
return state.updateIn(['modifiedData', ...action.keys], arr =>
|
return state.updateIn(['modifiedData', ...action.keys], arr =>
|
||||||
arr.push(fromJS(header))
|
arr.push(fromJS(header))
|
||||||
);
|
);
|
||||||
case 'DATA_SUBMITTED':
|
|
||||||
return state.update('initialData', () => state.get('modifiedData'));
|
|
||||||
case 'GET_DATA_SUCCEEDED': {
|
case 'GET_DATA_SUCCEEDED': {
|
||||||
const headers = get(action, ['data', 'headers'], {});
|
const headers = get(action, ['data', 'headers'], {});
|
||||||
let formattedHeaders = [header];
|
let formattedHeaders = [header];
|
||||||
@ -67,6 +65,8 @@ const reducer = (state, action) => {
|
|||||||
return state.update('formErrors', () => fromJS(action.errors));
|
return state.update('formErrors', () => fromJS(action.errors));
|
||||||
case 'SET_IS_TRIGGERING':
|
case 'SET_IS_TRIGGERING':
|
||||||
return state.update('isTriggering', isTriggering => !isTriggering);
|
return state.update('isTriggering', isTriggering => !isTriggering);
|
||||||
|
case 'SUBMIT_SUCCEEDED':
|
||||||
|
return state.update('initialData', () => state.get('modifiedData'));
|
||||||
case 'TRIGGER_SUCCEEDED':
|
case 'TRIGGER_SUCCEEDED':
|
||||||
return state
|
return state
|
||||||
.update('triggerResponse', () => fromJS(action.response))
|
.update('triggerResponse', () => fromJS(action.response))
|
||||||
|
@ -1,15 +1,25 @@
|
|||||||
|
import { NAME_REGEX, URL_REGEX } from './fieldsRegex';
|
||||||
|
|
||||||
const form = {
|
const form = {
|
||||||
name: {
|
name: {
|
||||||
styleName: 'col-6',
|
styleName: 'col-6',
|
||||||
label: 'Settings.webhooks.form.name',
|
label: 'Settings.webhooks.form.name',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
value: '',
|
value: '',
|
||||||
|
validations: {
|
||||||
|
required: true,
|
||||||
|
regex: NAME_REGEX,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
url: {
|
url: {
|
||||||
styleName: 'col-12',
|
styleName: 'col-12',
|
||||||
label: 'Settings.webhooks.form.url',
|
label: 'Settings.webhooks.form.url',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
value: '',
|
value: '',
|
||||||
|
validations: {
|
||||||
|
required: true,
|
||||||
|
regex: URL_REGEX,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
headers: {
|
headers: {
|
||||||
styleName: 'col-12',
|
styleName: 'col-12',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user