Actually implement persistent avatar removal in the front-end

This commit is contained in:
Toby Zerner 2015-05-19 09:26:59 +09:30
parent 811df6c278
commit f35fe5d0e2

View File

@ -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();
});
}
}