2015-05-14 17:21:45 -03:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
angular.module('copayApp.controllers').controller('preferencesEmailController',
|
2015-05-19 14:10:47 -03:00
|
|
|
function($scope, go, profileService, gettext, $log) {
|
2015-05-14 17:21:45 -03:00
|
|
|
this.save = function(form) {
|
2015-05-19 15:30:49 -03:00
|
|
|
var self = this;
|
2015-05-19 14:10:47 -03:00
|
|
|
this.error = null;
|
2015-05-14 17:21:45 -03:00
|
|
|
|
|
|
|
|
var fc = profileService.focusedClient;
|
2015-05-19 14:10:47 -03:00
|
|
|
this.saving = true;
|
|
|
|
|
fc.savePreferences({
|
|
|
|
|
email: this.email
|
|
|
|
|
}, function(err) {
|
2015-05-19 15:30:49 -03:00
|
|
|
self.saving = false;
|
2015-05-14 17:21:45 -03:00
|
|
|
if (err) {
|
|
|
|
|
$log.warn(err);
|
|
|
|
|
$scope.$emit('Local/ClientError', err);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2015-05-19 14:10:47 -03:00
|
|
|
$scope.$emit('Local/EmailUpdated', function(err){
|
|
|
|
|
go.path('preferences');
|
|
|
|
|
});
|
2015-05-14 17:21:45 -03:00
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|