import React from "react"; import { SpinnerCircular } from "spinners-react"; import { getBitrixFile } from "../../../../actions"; export default class TemplateFile extends React.Component { constructor(props) { super(props); this.state = { downloading: false } } _handle_onDownloadFile = () => { const { filename, url } = this.props.template; const { downloading } = this.state; if(!downloading) { this.setState({ downloading: true }, () => { getBitrixFile({ url, filename }) .then(() => { this.setState({ downloading: false }); }) .catch(() => { this.setState({ downloading: false }); }); }); } } render() { const { template } = this.props; const { downloading } = this.state; if(template !== undefined && template !== null) { return (
{ template.filename.substring(0, template.filename.lastIndexOf(".")) }
Скачать шаблон{ downloading ? (