Commit a0dc277d authored by Gauri Amol Pande's avatar Gauri Amol Pande
Browse files

Merge branch '37-display-username-on-homepage' into 'master'

Resolve "Display username on homepage"

Closes #37

See merge request 92khra1mst/hft_awado_app!22
parents ddf8d797 06c46c1c
master 18-design-feedback-page-2 20-ride-history 20-ride-history-2 39-validation-on-login-page 40-map-performance-improvement-map-angle-doesn-t-change-when-selected-3d 41-display-live-location-of-user-on-map 42-add-log-in-button-on-registration-page-add-extra-messages-for-email-and-password-validation 42-add-log-in-button-on-registration-page-add-extra-messages-for-email-and-password-validation-2 45-show-stepwise-navigation-instructions-on-my-ride-page 46-show-bicycle-route-between-bike-and-user-s-destination 47-show-alternate-routes-for-bike-to-destination 48-create-a-common-service-for-getting-user-s-current-location-and-live-location 49-show-loading-page 50-add-dependencies-locally-to-improve-app-performance 51-while-navigating-between-pages-map-doesn-t-load-properly 52-page-loader-is-getting-displayed-everywhere 53-scrollining-in-ride-history 53-scrollining-in-ride-history-2 55-change-password 56-create-dummy-page-or-menu-for-hotline-contact 57-registration-not-working-from-app 58-add-flow-on-navigate-button-to-route-from-user-to-bike 60-create-common-theming-styles-and-colors 61-chnage-styles-for-bike-list-and-bug-fixes 62-change-in-feedback-workflow 63-password-reset-api-integration 64-close-button-on-home-page-to-redirect-to-bike-list 66-highlight-selected-route-from-list-of-different-routes 67-deactivate-user-api-integration 68-display-no-go-areas-on-map 69-add-launcher-icon-for-application-on-android 70-add-validation-for-feedback-should-not-be-empty 71-prediction-ui-implementation-send-location-of-bike-to-backend 72-feedback-toast-message 73-removal-here-maps-api-key Show-Bike-details-when-bike-icon-is-clicked search_functionality
1 merge request!22Resolve "Display username on homepage"
Showing with 50 additions and 5 deletions
+50 -5
......@@ -4,6 +4,10 @@
<ion-header>
<ion-toolbar>
<ion-title>Menu</ion-title>
<div class="ion-text">
Welcome , {{userService.userDetails.username}}
</div>
</ion-toolbar>
</ion-header>
<ion-content>
......
.ion-text{
font-size: small;
color:black;
font-weight: bold;
margin-left: 20px;
margin-top: 3px;
}
\ No newline at end of file
......@@ -7,6 +7,7 @@ import { Storage } from '@ionic/storage';
import { Router } from '@angular/router';
import { RestService } from './rest.service';
import { UserService } from './services/user.service';
@Component({
selector: 'app-root',
......@@ -14,7 +15,7 @@ import { RestService } from './rest.service';
styleUrls: ['app.component.scss']
})
export class AppComponent {
username="";
isLoginPage = false;
public appPages = [
......@@ -39,6 +40,7 @@ export class AppComponent {
icon: 'exit'
}
];
constructor(
private platform: Platform,
......@@ -46,7 +48,9 @@ export class AppComponent {
private statusBar: StatusBar,
public restService: RestService,
private storage: Storage,
private router: Router) {
private router: Router,
public userService: UserService) {
this.username = this.userService.getUsername();
this.initializeApp();
......
......@@ -5,6 +5,7 @@ import { Observable } from 'rxjs';
import { HttpClient } from '@angular/common/http';
import { RestService } from '../../rest.service';
import { UserService } from 'src/app/services/user.service';
@Component({
selector: 'app-login',
......@@ -12,14 +13,14 @@ import { RestService } from '../../rest.service';
styleUrls: ['./login.page.scss'],
})
export class LoginPage implements OnInit {
username = "Bob@mail.com";
password = "BobPassword";
username = "";
password = "";
//username = "";
//password = "";
correctCredentials = false;
loginApi: Observable<any>;
constructor(private router: Router, public httpClient: HttpClient, public restService: RestService) {
constructor(private router: Router, public httpClient: HttpClient, public restService: RestService,public userService: UserService) {
}
......@@ -41,6 +42,7 @@ export class LoginPage implements OnInit {
//console.log('my data: ', data);
this.restService.setToken(data.token);
this.restService.isLoginPage = false;
this.userService.setUsername(this.username);
this.router.navigateByUrl('/home');
}, (error) => {
console.log(JSON.stringify(error));
......
import { TestBed } from '@angular/core/testing';
import { UserService } from './user.service';
describe('UserService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: UserService = TestBed.get(UserService);
expect(service).toBeTruthy();
});
});
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class UserService {
userDetails = {name : "",username:""}
constructor() { }
public getUsername(){
return this.userDetails.username
}
public setUsername (username){
this.userDetails.username = username
}
}
Supports Markdown
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