Commit a6f47bee authored by Ratnadeep Rajendra Kharade's avatar Ratnadeep Rajendra Kharade
Browse files

Fixed bug on login page.

parent db76e59f
<ion-app>
<ion-split-pane contentId="main-content">
<ion-menu contentId="main-content" type="overlay" *ngIf="restService.isUserLoggedIn">
<ion-menu contentId="main-content" type="overlay" *ngIf="restService.isUserLoggedIn && !restService.isLoginPage">
<ion-header>
<ion-toolbar>
<ion-title>Menu</ion-title>
......
......@@ -15,7 +15,7 @@ import { RestService } from './rest.service';
})
export class AppComponent {
isLoginPage = false;
public appPages = [
{
......@@ -36,9 +36,16 @@ export class AppComponent {
private statusBar: StatusBar,
public restService: RestService,
private storage: Storage,
private router: Router
) {
private router: Router) {
this.initializeApp();
let href = window.location.pathname
if(href === "/login") {
this.restService.isLoginPage = true;
} else {
this.restService.isLoginPage = false;
}
this.storage.get('token').then((token) => {
if(token === "") {
this.router.navigateByUrl('/login');
......
......@@ -38,6 +38,7 @@ export class LoginPage implements OnInit {
.subscribe((data) => {
console.log('my data: ', data);
this.restService.setToken(data.token);
this.restService.isLoginPage = false;
this.router.navigateByUrl('/home');
}, (error) => {
console.log(error);
......
......@@ -7,6 +7,7 @@ import { Storage } from '@ionic/storage';
export class RestService {
public isUserLoggedIn = false;
public isLoginPage = false;
constructor(private storage: Storage) { }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment