src/components/addLocation/AddLocation.js
// when the save changes button is clicked, the new data is sent to the server via put request
when the save changes button is clicked, the new data is sent to the server via put request
when the save changes button is clicked the new data is sent to the server via put request
saveChanges() {
        try {
            const requestBody = JSON.stringify({
                username: this.state.username,
                birthDate: this.state.birthDate
            });
            const url = '/users/' + this.state.loggedInUserId;
            api.put(url, requestBody);
            this.props.history.push('/game/dashboard/user');
        } catch (e) {
            alert(`Something went wrong while editing the profile: \n${handleError(e)}`);
        }
    }
saveChanges ( ) { try { const requestBody = JSON . stringify ( { username : this . state . username , birthDate : this . state . birthDate } ) ; const url = '/users/' + this . state . loggedInUserId ; api . put ( url , requestBody ) ; this . props . history . push ( '/game/dashboard/user' ) ; } catch ( e ) { alert ( ` \n ${ handleError ( e ) } ` ) ; } }
when the save changes button is clicked, the new data is sent to the server via put request
when the save changes button is clicked the new data is sent to the server via put request
// after successfully saving the changes, the user is redirected to his profile page