summaryrefslogtreecommitdiff
path: root/opendc-web/opendc-web-ui/src/containers/modals/DeleteRoomModal.js
blob: 9a7be6a60c6e630309377502d7c83addef0b342f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import React from 'react'
import { useDispatch, useSelector } from 'react-redux'
import { closeDeleteRoomModal } from '../../actions/modals/topology'
import { deleteRoom } from '../../actions/topology/room'
import ConfirmationModal from '../../components/modals/ConfirmationModal'

const DeleteRoomModal = (props) => {
    const visible = useSelector((state) => state.modals.deleteRoomModalVisible)

    const dispatch = useDispatch()
    const callback = (isConfirmed) => {
        if (isConfirmed) {
            dispatch(deleteRoom())
        }
        dispatch(closeDeleteRoomModal())
    }
    return (
        <ConfirmationModal
            title="Delete this room"
            message="Are you sure you want to delete this room?"
            show={visible}
            callback={callback}
            {...props}
        />
    )
}

export default DeleteRoomModal