clear token on sign out

This commit is contained in:
annampak 2017-10-17 14:58:07 +03:00
parent b503ca6901
commit dc2b741682
2 changed files with 5 additions and 4 deletions

View File

@ -76,6 +76,6 @@
</div> </div>
</div> </div>
<!-- <button type="button" class="btn btn-info" onclick="signOut();">Sign out</button> --> <!-- <button type="button" class="btn btn-info" onclick="signOut();">Sign out</button> -->
<a href="#" onclick="signOut();">Sign out</a> <a href="#" (click)="signOut2();">Sign out</a>
</div> </div>

View File

@ -11,6 +11,7 @@ import { dataModelBuilder } from '../../app/services/dataModelBuilder.service';
import { DataModel } from '../entities/DataModel'; import { DataModel } from '../entities/DataModel';
import { GroupBase } from './dynamic-form-group/group-base'; import { GroupBase } from './dynamic-form-group/group-base';
import { PaginationService } from '../../app/services/pagination.service'; import { PaginationService } from '../../app/services/pagination.service';
import { TokenService, TokenProvider } from '../services/token.service';
import './../../assets/xml2json.min.js'; import './../../assets/xml2json.min.js';
declare var X2JS: any; declare var X2JS: any;
@ -33,7 +34,7 @@ export class DynamicFormComponent implements OnInit {
xml2jsonOBJ: any; xml2jsonOBJ: any;
constructor(private qcs: FieldControlService, private serverService: ServerService, private dataModelService: dataModelBuilder, private router: Router, constructor(private qcs: FieldControlService, private serverService: ServerService, private dataModelService: dataModelBuilder, private router: Router,
private route: ActivatedRoute, private pagerService: PaginationService) { private route: ActivatedRoute, private pagerService: PaginationService, private tokenService : TokenService) {
this.form = this.qcs.toFormGroup(new Array(), new Array()); this.form = this.qcs.toFormGroup(new Array(), new Array());
this.xml2jsonOBJ = new X2JS(); this.xml2jsonOBJ = new X2JS();
} }
@ -160,8 +161,8 @@ signOut2() {debugger;
    auth2.signOut().then(function () {     auth2.signOut().then(function () {
      console.log('User signed out.');       console.log('User signed out.');
localStorage.removeItem('currentUser'); localStorage.removeItem('currentUser');
this.tokenService.setToken('token',null);
    });     });
this.tokenService.setToken(null); //kanonika prepei na mpei mesa sthn function.....
  }   }
onValueChanged(data?: any) { onValueChanged(data?: any) {