fixes #178
This commit is contained in:
parent
588668886d
commit
3a8e67d484
1 changed files with 18 additions and 10 deletions
|
@ -38,16 +38,24 @@ class SketchList extends React.Component {
|
||||||
{this.props.sketches.map(sketch =>
|
{this.props.sketches.map(sketch =>
|
||||||
<tr className="sketches-table__row visibility-toggle" key={sketch.id}>
|
<tr className="sketches-table__row visibility-toggle" key={sketch.id}>
|
||||||
<td>
|
<td>
|
||||||
<button
|
{(() => { // eslint-disable-line
|
||||||
className="sketch-list__trash-button"
|
console.log(this.props.username);
|
||||||
onClick={() => {
|
console.log(this.props.user.username);
|
||||||
if (window.confirm(`Are you sure you want to delete "${sketch.name}"?`)) {
|
if (this.props.username === this.props.user.username || this.props.username === undefined) {
|
||||||
this.props.deleteProject(sketch.id);
|
return (
|
||||||
}
|
<button
|
||||||
}}
|
className="sketch-list__trash-button"
|
||||||
>
|
onClick={() => {
|
||||||
<InlineSVG src={trashCan} alt="Delete Project" />
|
if (window.confirm(`Are you sure you want to delete "${sketch.name}"?`)) {
|
||||||
</button>
|
this.props.deleteProject(sketch.id);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<InlineSVG src={trashCan} alt="Delete Project" />
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})()}
|
||||||
</td>
|
</td>
|
||||||
<td scope="row"><Link to={`/projects/${sketch._id}`}>{sketch.name}</Link></td>
|
<td scope="row"><Link to={`/projects/${sketch._id}`}>{sketch.name}</Link></td>
|
||||||
<td>{moment(sketch.createdAt).format('MMM D, YYYY h:mm:ss A')}</td>
|
<td>{moment(sketch.createdAt).format('MMM D, YYYY h:mm:ss A')}</td>
|
||||||
|
|
Loading…
Reference in a new issue