Minor changes

This commit is contained in:
Nikolaos Laskaris 2017-10-17 11:23:40 +03:00
parent f29f2e7af3
commit 3a0df34f12
3 changed files with 8 additions and 5 deletions

View File

@ -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 {

View File

@ -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));

View File

@ -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(