Skip to content

Commit

Permalink
#165 added function to add button in dialog box
Browse files Browse the repository at this point in the history
  • Loading branch information
cynthiac3 committed Feb 2, 2020
1 parent dd4191a commit 7b3d2f2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tutify/src/components/Resources/AddResource.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ class AddResource extends Component {
category: '',
educationLevel: '',
};
this.addResourceToDB = this.addResourceToDB.bind(this);
}

addResourceToDB = () => {
addResourceToDB = (event) => {
event.preventDefault();
axios.post('/api/addResource', {
title: this.state.title,
description: this.state.description,
Expand All @@ -42,7 +44,6 @@ class AddResource extends Component {
.catch(err => console.error("Could not add the resource to the database: "+err));
}


render() {
const { open, handleClose } = this.props
const { scroll } = this.state
Expand Down Expand Up @@ -162,7 +163,7 @@ class AddResource extends Component {
>
<Grid item>
<DialogActions>
<Button>Add</Button>
<Button onClick={event => this.addResourceToDB(event)}>Add</Button>
</DialogActions>
</Grid>
<Grid item>
Expand Down

0 comments on commit 7b3d2f2

Please sign in to comment.