From 3a0df34f126c25ef805d152b75e7535811132275 Mon Sep 17 00:00:00 2001 From: Nikolaos Laskaris Date: Tue, 17 Oct 2017 11:23:40 +0300 Subject: [PATCH] Minor changes --- dmp-frontend/src/app/app.module.ts | 3 ++- dmp-frontend/src/app/login/login-page.ts | 3 ++- dmp-frontend/src/app/services/server.service.ts | 7 ++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/dmp-frontend/src/app/app.module.ts b/dmp-frontend/src/app/app.module.ts index d8db18a98..b1d9312ff 100644 --- a/dmp-frontend/src/app/app.module.ts +++ b/dmp-frontend/src/app/app.module.ts @@ -10,6 +10,7 @@ import { DynamicFormComponent } from './form/dynamic-form.component'; import { DynamicFormFieldComponent } from './form/fields/dynamic-form-field.component'; import { ServerService } from './services/server.service'; import { TokenService, TokenProvider } from './services/token.service'; +import { LocalStorageService } from 'ngx-webstorage'; import { dataModelBuilder } from './services/dataModelBuilder.service'; import { DynamicFormGroupComponent } from './form/dynamic-form-group/dynamic-form-group.component'; import { LoginComponent } from './login/login-page'; @@ -42,7 +43,7 @@ import { PaginationService } from './services/pagination.service'; AppRoutingModule ], - providers: [ServerService, dataModelBuilder, AuthGuard, PaginationService, TokenService], + providers: [ServerService, dataModelBuilder, AuthGuard, PaginationService, TokenService, LocalStorageService], bootstrap: [AppComponent] }) export class AppModule { diff --git a/dmp-frontend/src/app/login/login-page.ts b/dmp-frontend/src/app/login/login-page.ts index 5b65ae980..efe7ca6bc 100644 --- a/dmp-frontend/src/app/login/login-page.ts +++ b/dmp-frontend/src/app/login/login-page.ts @@ -43,8 +43,9 @@ export class LoginComponent implements OnInit{ this.tokenService.setProvider(TokenProvider.google); this.tokenService.setLoggedIn(true); this.tokenService.setEmail(profile.getEmail()); - this.tokenService.setUsername(); //GEMISE AYTO... + this.tokenService.setUsername(profile.getName()); + /* AYTA FEYGOUN, xanontai me to refresh tis selidas localStorage.setItem('currentUser', JSON.stringify(googleUser)); diff --git a/dmp-frontend/src/app/services/server.service.ts b/dmp-frontend/src/app/services/server.service.ts index ce862cce4..ff44b3f77 100644 --- a/dmp-frontend/src/app/services/server.service.ts +++ b/dmp-frontend/src/app/services/server.service.ts @@ -9,6 +9,7 @@ import { DatasetProfile } from '../entities/datasetprofile'; import {DataModel} from '../entities/DataModel'; import {Project} from '../entities/model/project'; import {LoginComponent} from '../../app/login/login-page'; +import { TokenService, TokenProvider } from './token.service'; import './../../assets/xml2json.min.js'; @@ -33,7 +34,7 @@ export class ServerService { data: any; - constructor(private http: Http) { //private http: Http + constructor(private http: Http, private tokenService: TokenService) { //private http: Http this.xml2jsonOBJ = new X2JS(); } @@ -44,9 +45,9 @@ export class ServerService { return this.data; //use the already loaded one //let headers = new HttpHeaders(); - let headers = new HttpHeaders().set("google-token", LoginComponent.token); + let headers = new HttpHeaders().set("google-token", this.tokenService.getToken()); -console.log("google-token: "+ LoginComponent.token); +console.log("google-token: "+ this.tokenService.getToken()); return this.http.get(this.fetchURL) .map(