/home/techb158/l2hypotheques.com/wp-content/plugins/complianz-gdpr/settings/src/Modal
Edit: /home/techb158/l2hypotheques.com/wp-content/plugins/complianz-gdpr/settings/src/Modal/Modal.js (3330B)
import {Component} from "@wordpress/element";
import { __ } from '@wordpress/i18n';
import * as cmplz_api from "../utils/api";
import Icon from "../utils/Icon";
class Modal extends Component {
constructor() {
super( ...arguments );
this.state = {
data:[],
buttonsDisabled:false,
};
}
dismissModal(dropItem){
this.props.handleModal(false, null, dropItem);
}
componentDidMount() {
this.setState({
data:this.props.data,
buttonsDisabled:false,
});
}
handleFix(e){
//set to disabled
let action = this.props.data.action;
this.setState({
buttonsDisabled:true
});
cmplz_api.doAction(action, 'refresh', this.props.data ).then( ( response ) => {
this.props.data
let {
data,
} = this.state;
data.description = response.msg;
data.subtitle = '';
this.setState({
data: data,
});
let item = this.props.data;
if (response.success) {
this.dismissModal(this.props.data);
}
});
}
render(){
const {
data,
buttonsDisabled,
} = this.state;
let disabled = buttonsDisabled ? 'disabled' : '';
let description = data.description;
return (
this.dismissModal(e) }>
{data.title}
{data.subtitle &&
{data.subtitle}
}
{ Array.isArray(description) && description.map(
(s, i) =>
{s}
) }
)
}
}
export default Modal;