Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
hdastageeri
hft_awado_app
Commits
7fa348ca
Commit
7fa348ca
authored
Nov 28, 2019
by
Ratnadeep Rajendra Kharade
Browse files
Removed navigation menu from login page and handled session condition.
parent
d38661cb
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/app/app.component.html
View file @
7fa348ca
<ion-app>
<ion-split-pane
contentId=
"main-content"
>
<ion-menu
contentId=
"main-content"
type=
"overlay"
>
<ion-menu
contentId=
"main-content"
type=
"overlay"
*ngIf=
"restService.isUserLoggedIn"
>
<ion-header>
<ion-toolbar>
<ion-title>
Menu
</ion-title>
...
...
src/app/app.component.ts
View file @
7fa348ca
...
...
@@ -3,6 +3,10 @@ import { Component } from '@angular/core';
import
{
Platform
}
from
'
@ionic/angular
'
;
import
{
SplashScreen
}
from
'
@ionic-native/splash-screen/ngx
'
;
import
{
StatusBar
}
from
'
@ionic-native/status-bar/ngx
'
;
import
{
Storage
}
from
'
@ionic/storage
'
;
import
{
Router
}
from
'
@angular/router
'
;
import
{
RestService
}
from
'
./rest.service
'
;
@
Component
({
selector
:
'
app-root
'
,
...
...
@@ -10,6 +14,9 @@ import { StatusBar } from '@ionic-native/status-bar/ngx';
styleUrls
:
[
'
app.component.scss
'
]
})
export
class
AppComponent
{
public
appPages
=
[
{
title
:
'
Home
'
,
...
...
@@ -26,9 +33,19 @@ export class AppComponent {
constructor
(
private
platform
:
Platform
,
private
splashScreen
:
SplashScreen
,
private
statusBar
:
StatusBar
private
statusBar
:
StatusBar
,
public
restService
:
RestService
,
private
storage
:
Storage
,
private
router
:
Router
)
{
this
.
initializeApp
();
this
.
storage
.
get
(
'
token
'
).
then
((
token
)
=>
{
if
(
token
===
""
)
{
this
.
router
.
navigateByUrl
(
'
/login
'
);
}
else
{
this
.
restService
.
isUserLoggedIn
=
true
;
}
});
}
initializeApp
()
{
...
...
src/app/auth/login/login.page.ts
View file @
7fa348ca
...
...
@@ -46,7 +46,5 @@ export class LoginPage implements OnInit {
}
register
()
{
this
.
router
.
navigateByUrl
(
'
/register
'
);
}
}
src/app/rest.service.ts
View file @
7fa348ca
...
...
@@ -6,11 +6,13 @@ import { Storage } from '@ionic/storage';
})
export
class
RestService
{
public
isUserLoggedIn
=
false
;
constructor
(
private
storage
:
Storage
)
{
}
setToken
(
token
)
{
// set a key/value
this
.
storage
.
set
(
'
token
'
,
token
);
this
.
isUserLoggedIn
=
true
;
}
getToken
()
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment