From 9fd5995703f1b4c21e115fe5ae67a06849b88580 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Tue, 19 May 2015 09:26:59 +0930 Subject: [PATCH] Actually implement persistent avatar removal in the front-end --- .../core/js/forum/src/components/avatar-editor.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/framework/core/js/forum/src/components/avatar-editor.js b/framework/core/js/forum/src/components/avatar-editor.js index dafc206b3..cab0834a8 100644 --- a/framework/core/js/forum/src/components/avatar-editor.js +++ b/framework/core/js/forum/src/components/avatar-editor.js @@ -85,8 +85,19 @@ export default class AvatarEditor extends Component { } remove() { - this.props.user.pushData({avatarUrl: null}); - delete this.props.user.avatarColor; + var self = this; + var user = this.props.user; + self.loading(true); m.redraw(); + m.request({ + method: 'DELETE', + url: app.config['api_url']+'/users/'+user.id()+'/avatar', + config: app.session.authorize.bind(app.session) + }).then(function(data) { + self.loading(false); + app.store.pushPayload(data); + delete user.avatarColor; + m.redraw(); + }); } }