sendAnswers()

in Serverless/Serverless Web App with React, DynamoDb, and X-Ray/ClientApp/src/components/Quiz.js [40:71]


    sendAnswers(e) {
        e.preventDefault();
        this.handleDismiss();
        var url = `${API_ROOT}/Lyrics/`;
        

        fetch(url, {
            method: 'POST',
            headers: {
                'Accept': 'application/json',
                'Content-Type': 'application/json',
            },
            body: JSON.stringify({
                Artist: this.state.artist,
                Title: this.state.title,
                })
            })
            .then(response => response.json())
            .then((result) => {
               
                if (result.isCorrect) {
                    this.handleShow();
                }
                else {
                    this.handleError();
                }
                this.handleFormReset();
            },
            (error) => {
                this.handleShow();
            })
    }