[Auth] Add clientAuth to build request to back
This commit is contained in:
parent
114c20dd26
commit
e6df9cbba0
@ -115,4 +115,31 @@ export default class Auth extends BaseApiService {
|
|||||||
return Promise.reject(err);
|
return Promise.reject(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async clientAuth(body: IClientAuthParams): Promise<IClientAuthReturn> {
|
||||||
|
// Construct the full URL for the client-auth endpoint
|
||||||
|
// This endpoint is at /api/v1/client-auth, not part of the customer auth namespace
|
||||||
|
const url = new URL(this.baseURl.concat("/client-auth"));
|
||||||
|
try {
|
||||||
|
// Create custom headers for this specific endpoint
|
||||||
|
const headers = new Headers();
|
||||||
|
headers.set("Content-Type", "application/json");
|
||||||
|
headers.set("x-session-id", body.sessionId);
|
||||||
|
|
||||||
|
const response = await fetch(url, {
|
||||||
|
method: "POST",
|
||||||
|
headers,
|
||||||
|
body: JSON.stringify({ pairingId: body.pairingId })
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return await response.json();
|
||||||
|
} catch (err) {
|
||||||
|
this.onError(err);
|
||||||
|
return Promise.reject(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user