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
a6f47bee
Commit
a6f47bee
authored
Nov 29, 2019
by
Ratnadeep Rajendra Kharade
Browse files
Fixed bug on login page.
parent
db76e59f
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/app/app.component.html
View file @
a6f47bee
<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>
...
...
src/app/app.component.ts
View file @
a6f47bee
...
...
@@ -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
'
);
...
...
src/app/auth/login/login.page.ts
View file @
a6f47bee
...
...
@@ -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
);
...
...
src/app/rest.service.ts
View file @
a6f47bee
...
...
@@ -7,6 +7,7 @@ import { Storage } from '@ionic/storage';
export
class
RestService
{
public
isUserLoggedIn
=
false
;
public
isLoginPage
=
false
;
constructor
(
private
storage
:
Storage
)
{
}
...
...
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