[feat] - add user lsit , convert to coop and lock unlock user

This commit is contained in:
2024-08-19 17:05:10 +07:00
parent 57b9371d2a
commit 3cc3d72eb5
24 changed files with 617 additions and 91 deletions

View File

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