diff --git a/js/control/Profile.js b/js/control/Profile.js index d234fcb..f1f7af4 100644 --- a/js/control/Profile.js +++ b/js/control/Profile.js @@ -82,11 +82,15 @@ BR.Profile = L.Evented.extend({ $(button).button('uploading'); evt.preventDefault(); + var that = this; this.fire('update', { profileText: profile, - callback: function() { + callback: function(err, profileId, profileText) { $(button).button('reset'); $(button).blur(); + if (!err) { + that.cache[profileId] = profileText; + } } }); }, @@ -116,9 +120,14 @@ BR.Profile = L.Evented.extend({ _save: function(evt) { var profileText = this._buildCustomProfile(); + var that = this; this.fire('update', { profileText: profileText, - callback: function() {} + callback: function(err, profileId, profileText) { + if (!err) { + that.cache[profileId] = profileText; + } + } }); }, diff --git a/js/index.js b/js/index.js index 200c8e2..48742fe 100644 --- a/js/index.js +++ b/js/index.js @@ -187,7 +187,7 @@ } if (evt.callback) { - evt.callback(); + evt.callback(err, profileId, evt.profileText); } }); });