parent
2e298bf267
commit
f1adb7f0ae
|
|
@ -473,9 +473,11 @@ class NodeResponse implements ApiResponse {
|
|||
*/
|
||||
export class ApiClientNodeImpl implements LibreCcmApiClient {
|
||||
readonly #baseUrl: string;
|
||||
readonly #jwt: string;
|
||||
|
||||
constructor(baseUrl: string) {
|
||||
constructor(baseUrl: string, jwt: string) {
|
||||
this.#baseUrl = baseUrl;
|
||||
this.#jwt = jwt;
|
||||
}
|
||||
|
||||
get(
|
||||
|
|
@ -486,7 +488,7 @@ export class ApiClientNodeImpl implements LibreCcmApiClient {
|
|||
const url = buildUrl(this.#baseUrl, endpoint, searchParams);
|
||||
const request: http.ClientRequest = http.request(url, {
|
||||
headers: {
|
||||
Authorization: "",
|
||||
Authorization: this.#jwt,
|
||||
},
|
||||
method: "GET",
|
||||
});
|
||||
|
|
@ -529,7 +531,7 @@ export class ApiClientNodeImpl implements LibreCcmApiClient {
|
|||
const url = buildUrl(this.#baseUrl, endpoint, searchParams);
|
||||
const request: http.ClientRequest = http.request(url, {
|
||||
headers: {
|
||||
Authorization: "",
|
||||
Authorization: this.#jwt,
|
||||
},
|
||||
method: "POST",
|
||||
});
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ export function buildNodeApiClient(
|
|||
baseUrl: string,
|
||||
jwt: string
|
||||
): LibreCcmApiClient {
|
||||
return new ApiClientNodeImpl();
|
||||
return new ApiClientNodeImpl(baseUrl, jwt);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue