login fix
This commit is contained in:
@@ -3,6 +3,8 @@ import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
//import 'rxjs/add/operator/map';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { SessionDataProviderService } from '../store/session-data-provider.service';
|
||||
import {Router} from "@angular/router";
|
||||
|
||||
|
||||
@Injectable({
|
||||
@@ -13,12 +15,20 @@ export class WrenchService {
|
||||
apiKey = '99dfe35fcb7de1ee';
|
||||
url;
|
||||
|
||||
constructor(private http: HttpClient) {
|
||||
|
||||
constructor(private http: HttpClient,
|
||||
private router: Router,
|
||||
public sessionDataProviderService :SessionDataProviderService) {
|
||||
// this is test
|
||||
this.url = 'https://apigate.lotus.g1.wrenchboard.com/en/wrench/api/v1';
|
||||
}
|
||||
|
||||
getPostData(reqPath:string, reqData): Observable<any> {
|
||||
|
||||
if (reqPath != 'userlogin'){
|
||||
const sessionId = this.sessionDataProviderService.session;
|
||||
if (sessionId.length==0){
|
||||
this.router.navigate(['login']);
|
||||
}
|
||||
}
|
||||
return this.http.post(
|
||||
`${environment.baseUrl}/${reqPath}`,reqData
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user