diff options
Diffstat (limited to 'webapp/components/admin_console')
-rw-r--r-- | webapp/components/admin_console/brand_image_setting.jsx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/webapp/components/admin_console/brand_image_setting.jsx b/webapp/components/admin_console/brand_image_setting.jsx index 74f2290af..74d0814a6 100644 --- a/webapp/components/admin_console/brand_image_setting.jsx +++ b/webapp/components/admin_console/brand_image_setting.jsx @@ -40,6 +40,19 @@ export default class BrandImageSetting extends React.Component { }); } + componentDidUpdate() { + if (this.refs.image) { + const reader = new FileReader(); + + const img = this.refs.image; + reader.onload = (e) => { + $(img).attr('src', e.target.result); + }; + + reader.readAsDataURL(this.state.brandImage); + } + } + handleImageChange() { const element = $(this.refs.fileInput); @@ -151,6 +164,7 @@ export default class BrandImageSetting extends React.Component { ref='fileInput' type='file' accept='.jpg,.png,.bmp' + disabled={this.props.disabled} onChange={this.handleImageChange} /> </div> |