ionic-coreo
Version:
Ionic2 module for integration with Coreo
54 lines • 2.34 kB
JavaScript
;
var core_1 = require('@angular/core');
var username_confirmation_component_template_1 = require('./username-confirmation.component.template');
var login_component_template_1 = require('../login.component.template');
var forms_1 = require('@angular/forms');
var ionic_angular_1 = require('ionic-angular');
var auth_1 = require('../../../auth');
var user_1 = require('../../../user');
var CoreoUsernameConfirmationComponent = (function () {
function CoreoUsernameConfirmationComponent(formBuilder, user, auth, viewCtrl, navCtrl, navParams) {
this.auth = auth;
this.viewCtrl = viewCtrl;
this.navCtrl = navCtrl;
this.navParams = navParams;
this.usernameError = false;
this.isSubmitting = false;
this.usernameForm = formBuilder.group({
username: [user.username, forms_1.Validators.required]
});
}
CoreoUsernameConfirmationComponent.prototype.confirmUsername = function (event) {
var _this = this;
event.preventDefault();
var username = this.usernameForm.value.username;
this.isSubmitting = true;
this.usernameError = false;
this.auth.updateUsername(username).then(function () {
var onSuccess = _this.navParams.get('onSuccess');
_this.viewCtrl.dismiss();
onSuccess();
}, function (err) {
_this.isSubmitting = false;
_this.usernameError = err.message;
});
};
CoreoUsernameConfirmationComponent.decorators = [
{ type: core_1.Component, args: [{
template: username_confirmation_component_template_1.DEFAULT_TEMPLATE,
styles: [login_component_template_1.SHARED_STYLES]
},] },
];
/** @nocollapse */
CoreoUsernameConfirmationComponent.ctorParameters = function () { return [
{ type: forms_1.FormBuilder, },
{ type: user_1.CoreoUser, },
{ type: auth_1.CoreoAuth, },
{ type: ionic_angular_1.ViewController, },
{ type: ionic_angular_1.NavController, },
{ type: ionic_angular_1.NavParams, },
]; };
return CoreoUsernameConfirmationComponent;
}());
exports.CoreoUsernameConfirmationComponent = CoreoUsernameConfirmationComponent;
//# sourceMappingURL=username-confirmation.component.js.map