handleSubmit(key) {

        let url = '';

        if (this.state.dropDown === 'Delete') {
            url = '/goal/delete'
        } else if (this.state.dropDown === 'Complete') {
            url = '/goal/complete';
        } else {
            url = '/goal/update'
        }

        fetch(url, {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json',
            },
            body: JSON.stringify({
                id: this.state.id,
                goalTitle: this.state.modalTitle,
                goalDescription: this.state.modalDescription,
                goalImage: this.state.modalImage,
                starred: this.state.starred,
                completed: this.state.completed
            }),
        });

        window.location.reload();
    }
// Handles submission of form data and posts it to backend
Handles submission of form data and posts it to backend
Handles submission of form data and posts it to backend
handleSubmit(key) {
        let url = '';
        if (this.state.dropDown === 'Delete') {
            url = '/goal/delete'
        } else if (this.state.dropDown === 'Complete') {
            url = '/goal/complete';
        } else {
            url = '/goal/update'
        }
        fetch(url, {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json',
            },
            body: JSON.stringify({
                id: this.state.id,
                goalTitle: this.state.modalTitle,
                goalDescription: this.state.modalDescription,
                goalImage: this.state.modalImage,
                starred: this.state.starred,
                completed: this.state.completed
            }),
        });
        window.location.reload();
    }
handleSubmit ( key ) { let url = '' ; if ( this . state . dropDown === 'Delete' ) { url = '/goal/delete' } else if ( this . state . dropDown === 'Complete' ) { url = '/goal/complete' ; } else { url = '/goal/update' } fetch ( url , { method : 'POST' , headers : { 'Content-Type' : 'application/json' , } , body : JSON . stringify ( { id : this . state . id , goalTitle : this . state . modalTitle , goalDescription : this . state . modalDescription , goalImage : this . state . modalImage , starred : this . state . starred , completed : this . state . completed } ) , } ) ; window . location . reload ( ) ; }
Handles submission of form data and posts it to backend
Handles submission of form data and posts it to backend