32 lines
840 B
TypeScript
32 lines
840 B
TypeScript
import { HttpClient } from '@angular/common/http';
|
|
import { Injectable } from '@angular/core';
|
|
import { map, Observable } from 'rxjs';
|
|
import { environment } from 'src/environments/environment';
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class SathonCathayPayService {
|
|
endpoint: string = environment.CATHAYAPIURL
|
|
constructor(
|
|
private http: HttpClient
|
|
) { }
|
|
|
|
getAllUsers(): Observable<[]> {
|
|
return this.http.get<[]>(`${this.endpoint}/v1/user`).pipe(map((d: any) => d.data))
|
|
}
|
|
|
|
|
|
|
|
lockUnlockUser(id: string): Observable<any> {
|
|
const request = { userId: id }
|
|
return this.http.post(`${this.endpoint}/v2/Authentication/LockUnlock`, request)
|
|
}
|
|
|
|
|
|
convertToCoperate(id: string): Observable<any> {
|
|
const request = { id }
|
|
return this.http.post(`${this.endpoint}/v1/User/convert2coperateType`, request)
|
|
}
|
|
}
|