[feat] - add user lsit , convert to coop and lock unlock user
This commit is contained in:
@@ -1,15 +1,18 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {HttpErrorResponse, HttpEvent, HttpHandler, HttpInterceptor, HttpRequest} from '@angular/common/http';
|
||||
import {Router} from '@angular/router';
|
||||
import {AppService} from './app.service';
|
||||
import {catchError, Observable, throwError} from 'rxjs';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpErrorResponse, HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';
|
||||
import { Router } from '@angular/router';
|
||||
import { AppService } from './app.service';
|
||||
import { catchError, Observable, throwError } from 'rxjs';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { SathonCathayPayService } from './sathon-cathay-pay.service';
|
||||
|
||||
|
||||
@Injectable()
|
||||
export class AppRequestInterceptor implements HttpInterceptor {
|
||||
constructor(
|
||||
private router: Router,
|
||||
private appService: AppService
|
||||
private appService: AppService,
|
||||
private sathonSV: SathonCathayPayService
|
||||
) {
|
||||
|
||||
}
|
||||
@@ -18,7 +21,7 @@ export class AppRequestInterceptor implements HttpInterceptor {
|
||||
|
||||
if (token) {
|
||||
request = request.clone({
|
||||
setHeaders: {Authorization: `Bearer ${token}`}
|
||||
setHeaders: { Authorization: `Bearer ${this.generateToken(request.url)}` }
|
||||
});
|
||||
}
|
||||
|
||||
@@ -33,4 +36,10 @@ export class AppRequestInterceptor implements HttpInterceptor {
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
generateToken(url: string) {
|
||||
if (url.includes('71dev')) return this.appService.token()
|
||||
if (url.includes('cathay-pay')) return this.appService.getsathonToken()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user