Page redirection based on user type

#1

I am trying to make an app which has two types of user. “Home user” & “Technician & Mechanic”. I’m using Firebase as my backend. I’m trying to navigate to different page based on the type of user after login.
Firebase database is structured as follows

"profiles" : {

"7omaG76TMKQwVnrSbXEdF7H5UwF3" : {

"dateOfBirth" : "2017-08-12",

"firstName" : "dsf",

"lastName" : "fddfs",

"type" : "Home user"

},

"kgVCcLVLggcS7AFX7LlGZx6a1Eu1" : {

"dateOfBirth" : "2001-07-12",

"firstName" : "fdgghyyj",

"lastName" : "Ashik",

"type" : "Technician or Mechanic"

},

}


My login page is as follows

import { LoginResponse } from '../../model/login/login-response.interface';
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams, ToastController } from 'ionic-angular';
import { DataProvider } from './../../providers/data/data.provider';
import { User } from 'firebase';
import { TabsPage } from './../tabs/tabs';
import { Profile } from '../../model/profile/profile.interface';

@IonicPage()
@Component({
	selector: 'page-login',
	templateUrl: 'login.html'
})
export class LoginPage {
	constructor (
		public navCtrl: NavController,
		public navParams: NavParams,
		private toast: ToastController,
		private data: DataProvider
	) {}

	login (event: LoginResponse) {
		if (!event.error) {
			this.toast
				.create({
					message: `Welcome ${event.result.email}`,
					duration: 3000
				})
				.present();
			// this.data.getProfile(<User>event.result).subscribe((profile: Profile) => {
			// 	profile.val()
			// 		? () => {
			// 				if (profile.type == 'Technician or Mechanic') {
			// 					this.navCtrl.push('JobListPage');
			// 				}
			// 				else {
			// 					this.navCtrl.push('PostJobPage');
			// 				}
			// 			}
			// 		: this.navCtrl.setRoot('EditProfilePage');
			// });
			// this.navCtrl.setRoot('EditProfilePage');

			this.data.getProfile(<User>event.result).subscribe((profile: Profile) => {
				if (profile) {
					if (profile.type === 'Home user') {
						this.navCtrl.push('PostJobPage');
					}
					else {
						this.navCtrl.push('JobListPage');
					}
				}
				else {
					this.navCtrl.setRoot('EditProfilePage');
				}
			});
		}
		else {
			this.toast
				.create({
					message: event.error.message,
					duration: 3000
				})
				.present();
		}
	}
}

But with the existing logic whether the user has an account is checked. user is redirecting to the edit profile page if s/he has not created a profile yet.

But user is not redirecting to the respective page depending on the user type.Here profile.type==="Home user" portion is not working. the else portion is executing no matter it is Home user or Technician & Mechanic.