UNPKG

ionic-coreo

Version:

Ionic2 module for integration with Coreo

66 lines 2.74 kB
"use strict"; var core_1 = require('@angular/core'); var signup_component_template_1 = require('./signup.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 CoreoSignupComponent = (function () { function CoreoSignupComponent(formBuilder, viewCtrl, auth, navParams) { this.viewCtrl = viewCtrl; this.auth = auth; this.navParams = navParams; this.signupError = false; this.isSigningUp = false; this.isSignedUp = false; this.signup = formBuilder.group({ email: ['', forms_1.Validators.required], password: ['', forms_1.Validators.required], passwordConfirm: ['', forms_1.Validators.required], name: ['', forms_1.Validators.required] }); } CoreoSignupComponent.prototype.confirmValidation = function () { var cb = this.navParams.get('onSuccess'); var _a = this.signup.value, email = _a.email, password = _a.password; cb(email, password); this.viewCtrl.dismiss(); }; CoreoSignupComponent.prototype.handleSignup = function (event) { var _this = this; var _a = this.signup.value, email = _a.email, password = _a.password, passwordConfirm = _a.passwordConfirm, name = _a.name, username = _a.username; if (password !== passwordConfirm) { this.signupError = 'Passwords must match'; return; } this.isSigningUp = true; return this.auth.signup(email, password, name, username).then(function (data) { _this.isSigningUp = false; _this.isSignedUp = true; }, function (err) { _this.signupError = err; _this.isSigningUp = false; }); }; CoreoSignupComponent.prototype.cancel = function (event) { event.preventDefault(); event.stopImmediatePropagation(); this.viewCtrl.dismiss(); }; CoreoSignupComponent.decorators = [ { type: core_1.Component, args: [{ template: signup_component_template_1.DEFAULT_TEMPLATE, styles: [login_component_template_1.SHARED_STYLES] },] }, ]; /** @nocollapse */ CoreoSignupComponent.ctorParameters = function () { return [ { type: forms_1.FormBuilder, }, { type: ionic_angular_1.ViewController, }, { type: auth_1.CoreoAuth, }, { type: ionic_angular_1.NavParams, }, ]; }; return CoreoSignupComponent; }()); exports.CoreoSignupComponent = CoreoSignupComponent; //# sourceMappingURL=signup.component.js.map