Merge branch '108-when-i-delete-a-room-add-maybe-an-are-you-sure-confirmation-message' into 'dev'
fix Closes #108 See merge request sa4-2020/the-sanmarinoes/frontend!133
This commit is contained in:
commit
d77ff7dc08
1 changed files with 19 additions and 3 deletions
|
@ -8,6 +8,7 @@ import {
|
|||
Icon,
|
||||
Responsive,
|
||||
Image,
|
||||
Confirm,
|
||||
} from "semantic-ui-react";
|
||||
import SelectIcons from "./SelectIcons";
|
||||
import { connect } from "react-redux";
|
||||
|
@ -34,6 +35,7 @@ class RoomModal extends Component {
|
|||
name: this.type === "new" ? "New Room" : this.props.room.name,
|
||||
img: this.type === "new" ? null : this.props.room.image,
|
||||
openModal: false,
|
||||
sure: false,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -91,6 +93,14 @@ class RoomModal extends Component {
|
|||
.catch((err) => console.error("error in deleting room", err));
|
||||
};
|
||||
|
||||
setSureTrue = () => {
|
||||
this.setState({sure: true})
|
||||
}
|
||||
|
||||
setSureFalse= () => {
|
||||
this.setState({sure: false})
|
||||
}
|
||||
|
||||
changeSomething = (event) => {
|
||||
let nam = event.target.name;
|
||||
let val = event.target.value;
|
||||
|
@ -220,16 +230,22 @@ class RoomModal extends Component {
|
|||
</div>
|
||||
|
||||
{this.type === "modify" ? (
|
||||
<div>
|
||||
<Button
|
||||
icon
|
||||
labelPosition="left"
|
||||
inverted
|
||||
color="red"
|
||||
onClick={this.deleteRoom}
|
||||
onClick={this.setSureTrue}
|
||||
>
|
||||
<Icon name="trash alternate" />
|
||||
Delete room
|
||||
</Button>
|
||||
Delete Room </Button>
|
||||
<Confirm
|
||||
open={this.state.sure}
|
||||
onCancel={this.setSureFalse}
|
||||
onConfirm={this.deleteRoom}/>
|
||||
</div>
|
||||
|
||||
) : null}
|
||||
</Modal.Content>
|
||||
<Modal.Actions>
|
||||
|
|
Loading…
Reference in a new issue