forked from ReactJSResources/react-webpack-babel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from ZachLamb/deleteGrid
Delete grid
- Loading branch information
Showing
6 changed files
with
63 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,43 @@ | ||
import React from 'react'; | ||
import * as firebase from 'firebase'; | ||
|
||
import styles from '../main.scss'; | ||
|
||
import {manageLogin} from '../util/login.js' | ||
|
||
export default class DeleteGrid extends React.Component { | ||
render(){ | ||
constructor(){ | ||
super(); | ||
this.handleClick = this.handleClick.bind( this ); | ||
this.deleteUserGrid = this.deleteUserGrid.bind( this ); | ||
} | ||
|
||
handleClick(){ | ||
manageLogin(this.deleteUserGrid); | ||
} | ||
|
||
deleteUserGrid(uid){ | ||
this.gridRef = firebase.database().ref('grids/' + this.props.gridId | ||
+ "/users/" + uid); | ||
this.userRef = firebase.database().ref('users/' + uid + '/grids/' | ||
+ this.props.gridId); | ||
|
||
this.gridRef.remove(); | ||
this.userRef.remove(); | ||
this.props.gridRemoval(null); | ||
} | ||
|
||
render() { | ||
return( | ||
<button type="button" className={ "btn btn-danger " + styles.button }>Delete Grid</button> | ||
<button type="button" | ||
className="btn btn-danger" | ||
onClick={ this.handleClick }> | ||
Delete Grid | ||
</button> | ||
); | ||
} | ||
} | ||
} | ||
} | ||
|
||
DeleteGrid.propTypes = { | ||
gridId: React.PropTypes.string, | ||
gridRemoval: React.PropTypes.func | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters