client/components/RSVPForm.component.js
/**
     * Takes the collected wizard input across all forms and submits it to the database.
     */
Takes the collected wizard input across all forms and submits it to the database.
Takes the collected wizard input across all forms and submits it to the database .
submitRSVP() {
        const self = this;
        const state = this.state;
        if (this.validate()) {
            self.state.submitStatus = { isError: true, message: this.validate() };
            self.setState(self.state);
            return;
        }
        var guestInfo = Object.assign({}, state.guestInfo);
        var guestPlusOneInfo = Object.assign({}, state.guestPlusOneInfo);
        const willAttend = guestInfo.attendance !== 'no';
        if (guestPlusOneInfo.attendance === '1') {
            guestPlusOneInfo = undefined;
        }
        this.getAPIClient().rsvp(guestInfo, willAttend, guestPlusOneInfo, function (errorMsg, successMsg) {
            if (errorMsg) {
                self.state.submitStatus = { isError: true, message: errorMsg };
                self.setState(self.state);
            } else {
                self.state.submitStatus = {
                    isError: false, message: 'Your response was recorded successfully. Thank you!'
                };
                self.setState(self.state);
            }
        });
    }
submitRSVP ( ) { const self = this ; const state = this . state ; if ( this . validate ( ) ) { self . state . submitStatus = { isError : true , message : this . validate ( ) } ; self . setState ( self . state ) ; return ; } var guestInfo = Object . assign ( { } , state . guestInfo ) ; var guestPlusOneInfo = Object . assign ( { } , state . guestPlusOneInfo ) ; const willAttend = guestInfo . attendance !== 'no' ; if ( guestPlusOneInfo . attendance === '1' ) { guestPlusOneInfo = undefined ; } this . getAPIClient ( ) . rsvp ( guestInfo , willAttend , guestPlusOneInfo , function ( errorMsg , successMsg ) { if ( errorMsg ) { self . state . submitStatus = { isError : true , message : errorMsg } ; self . setState ( self . state ) ; } else { self . state . submitStatus = { isError : false , message : 'Your response was recorded successfully. Thank you!' } ; self . setState ( self . state ) ; } } ) ; }
Takes the collected wizard input across all forms and submits it to the database.
Takes the collected wizard input across all forms and submits it to the database .
// TODO: This is a hack, find a way to properly construct the request