From 94076a43961138c3572e7666416ed86ef9d10249 Mon Sep 17 00:00:00 2001 From: Mathieu Nayrolles Date: Tue, 29 Nov 2016 20:05:51 -0500 Subject: [PATCH] fix(signup): Auto-logging of user now kicks in correctly after signup Store the generated API key in local storage signup --- src/pages/signup/signup.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/pages/signup/signup.ts b/src/pages/signup/signup.ts index 5c6adf6..2a6bdee 100644 --- a/src/pages/signup/signup.ts +++ b/src/pages/signup/signup.ts @@ -1,5 +1,5 @@ import {NavController, NavParams, Loading, LoadingController} from 'ionic-angular'; - +import { Storage } from '@ionic/storage'; import { Component } from '@angular/core'; import {DashboardPage} from '../dashboard/dashboard'; @@ -27,6 +27,7 @@ export class SignupPage extends SignupComponent{ private nav: NavController, private navParams: NavParams, private loadingController: LoadingController, + private storage: Storage, //injection for SignupComponent translate: TranslateService, twapi: TwAPIService, @@ -37,11 +38,16 @@ export class SignupPage extends SignupComponent{ GAService.screenview("SIGNUP"); - this.userLogged.subscribe( - user => this.nav.setRoot(DashboardPage, { - user:user - }) - ); + this.userLogged.subscribe(user => { + this.nav.setRoot(DashboardPage, { + user:user + }); + GAService.userName = user.name + " " + user.lastname; + GAService.userEmail = user.email; + console.log("setting tw-api to", user.key); + this.storage.set('tw-api', user.key); + }); + this.signupAttempt.subscribe( attempt => {