remove onblur

Signed-off-by: Virginie Ky <virginie.ky@gmail.com>
This commit is contained in:
Virginie Ky 2020-01-20 15:59:25 +01:00
parent 8b4886515c
commit bfe0cf321e
4 changed files with 14 additions and 15 deletions

View File

@ -19,7 +19,6 @@ function Inputs({
label,
name,
onChange,
onBlur,
onClick,
onRemove,
type,
@ -34,7 +33,6 @@ function Inputs({
<HeadersInput
errors={customError}
name={name}
onBlur={onBlur}
onClick={onClick}
onChange={onChange}
onRemove={onRemove}
@ -77,7 +75,6 @@ function Inputs({
onChange={e => {
handleChange(e);
}}
onBlur={onBlur}
value={value}
/>
{hasError && <ErrorMessage>{error}</ErrorMessage>}
@ -106,7 +103,6 @@ Inputs.propTypes = {
customError: PropTypes.object,
label: PropTypes.string,
name: PropTypes.string.isRequired,
onBlur: PropTypes.func.isRequired,
onChange: PropTypes.func.isRequired,
onClick: PropTypes.func,
onRemove: PropTypes.func,

View File

@ -188,7 +188,7 @@ function EditView() {
if (isMounted.current) {
dispatch({
type: 'DATA_SUBMITTED',
type: 'SUBMIT_SUCCEEDED',
});
strapi.notification.success(`Settings.webhooks.created`);
@ -213,12 +213,6 @@ function EditView() {
const goBack = () => push('/settings/webhooks');
const handleBlur = () => {
if (submittedOnce) {
checkFormErrors();
}
};
const handleChange = ({ target: { name, value } }) => {
dispatch({
type: 'ON_CHANGE',
@ -351,7 +345,7 @@ function EditView() {
if (isMounted.current) {
dispatch({
type: 'DATA_SUBMITTED',
type: 'SUBMIT_SUCCEEDED',
});
strapi.notification.success('notification.form.success.fields');
}
@ -393,7 +387,6 @@ function EditView() {
})}
error={getErrorMessage(get(formErrors, key, null))}
name={key}
onBlur={handleBlur}
onChange={handleChange}
validations={form[key].validations}
value={modifiedData[key] || form[key].value}

View File

@ -24,8 +24,6 @@ const reducer = (state, action) => {
return state.updateIn(['modifiedData', ...action.keys], arr =>
arr.push(fromJS(header))
);
case 'DATA_SUBMITTED':
return state.update('initialData', () => state.get('modifiedData'));
case 'GET_DATA_SUCCEEDED': {
const headers = get(action, ['data', 'headers'], {});
let formattedHeaders = [header];
@ -67,6 +65,8 @@ const reducer = (state, action) => {
return state.update('formErrors', () => fromJS(action.errors));
case 'SET_IS_TRIGGERING':
return state.update('isTriggering', isTriggering => !isTriggering);
case 'SUBMIT_SUCCEEDED':
return state.update('initialData', () => state.get('modifiedData'));
case 'TRIGGER_SUCCEEDED':
return state
.update('triggerResponse', () => fromJS(action.response))

View File

@ -1,15 +1,25 @@
import { NAME_REGEX, URL_REGEX } from './fieldsRegex';
const form = {
name: {
styleName: 'col-6',
label: 'Settings.webhooks.form.name',
type: 'text',
value: '',
validations: {
required: true,
regex: NAME_REGEX,
},
},
url: {
styleName: 'col-12',
label: 'Settings.webhooks.form.url',
type: 'text',
value: '',
validations: {
required: true,
regex: URL_REGEX,
},
},
headers: {
styleName: 'col-12',