handleSubmit()

in public/components/contentSourceEdit.react.js [55:79]


    handleSubmit(e) {
        e.preventDefault();
        const appName = this.state.appName.trim();
        const description = this.state.description.trim();
        const reindexEndpoint = this.state.reindexEndpoint.trim();
        const authType = this.state.authType.trim();
        const supportsToFromParams = this.state.supportsToFromParams;
        const supportsCancelReindex = this.state.supportsCancelReindex;

        if (appName && description && reindexEndpoint && authType && !R.isNil(supportsToFromParams) && !R.isNil(supportsCancelReindex)) {
            this.handleFormSubmit(this.props.contentSource.id, this.props.contentSource.environment,
                {appName: appName,
                 description: description,
                 reindexEndpoint: reindexEndpoint,
                 authType: authType,
                 ...(this.state.headers ? { headers: headerListToHeaderMap(this.state.headers) } : {}),
                 contentSourceSettings: {
                     supportsToFromParams: supportsToFromParams,
                     supportsCancelReindex: supportsCancelReindex
                 }});
        } else {
            this.setState({alertStyle: 'danger', alertMessage: 'Invalid form. Correct the fields and try again.', alertVisibility: true});
            return;
        }
    }