summaryrefslogtreecommitdiffstats
path: root/webapp/components/admin_console
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2016-06-01 16:16:24 -0400
committerJoram Wilander <jwawilander@gmail.com>2016-06-01 16:16:24 -0400
commit75107dc15db932bbbb0df12666c0be5a64409ff6 (patch)
tree1433d3e51c0707f6627704eeeb37e80ac478a72b /webapp/components/admin_console
parent81535c0efb0ddf3d5acaad2236b27378bf12a68d (diff)
downloadchat-75107dc15db932bbbb0df12666c0be5a64409ff6.tar.gz
chat-75107dc15db932bbbb0df12666c0be5a64409ff6.tar.bz2
chat-75107dc15db932bbbb0df12666c0be5a64409ff6.zip
Fix brand image not showing up after selecting it and before uploading (#3197)
Diffstat (limited to 'webapp/components/admin_console')
-rw-r--r--webapp/components/admin_console/brand_image_setting.jsx14
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>