@opexa/portal-sdk 0.59.75 → 0.59.76

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4517,14 +4517,12 @@ var AuthService = class {
4517
4517
  headers.set("test-pass", input.testPass);
4518
4518
  }
4519
4519
  try {
4520
- const res = await fetch(
4521
- `${this.url}${version === 3 ? "/v3/sessions" : "/sessions"}`,
4522
- {
4523
- method: "POST",
4524
- headers,
4525
- body: JSON.stringify(input)
4526
- }
4527
- );
4520
+ const res = await fetch(`${this.url}${version !== 1 ? `/v${version}/sessions` : "/sessions"}`, {
4521
+ method: "POST",
4522
+ headers,
4523
+ body: JSON.stringify(input),
4524
+ ...version === 4 && { credentials: "include" }
4525
+ });
4528
4526
  const data = await res.json();
4529
4527
  if (res.ok) {
4530
4528
  return {
@@ -4605,14 +4603,20 @@ var AuthService = class {
4605
4603
  }
4606
4604
  throw new Error("Invalid input 'type'");
4607
4605
  }
4608
- async refreshSession(refreshToken) {
4606
+ async refreshSession(refreshToken, version = 1) {
4609
4607
  const headers = new Headers(this.headers);
4610
- headers.append("Authorization", `Bearer ${refreshToken}`);
4608
+ if (version !== 4) {
4609
+ headers.append("Authorization", `Bearer ${refreshToken}`);
4610
+ }
4611
4611
  try {
4612
- const res = await fetch(`${this.url}/session:refresh`, {
4613
- method: "POST",
4614
- headers
4615
- });
4612
+ const res = await fetch(
4613
+ `${this.url}${version === 4 ? "/v4/session/refresh" : "/session:refresh"}`,
4614
+ {
4615
+ method: "POST",
4616
+ headers,
4617
+ ...version === 4 && { credentials: "include" }
4618
+ }
4619
+ );
4616
4620
  const data = await res.json();
4617
4621
  if (res.ok) {
4618
4622
  return {