Skip to content

Commit

Permalink
fix: TypeError: Headers constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
trandaison committed Oct 3, 2024
1 parent 4e89507 commit 4aad9d4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/runtime/services/Auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class Auth implements AuthService {
this.config.endpoints.login.method,
this.config.endpoints.login.url,
credentials,
{ headers: this.config.endpoints.login.headers }
{ headers: new Headers({ ...this.config.endpoints.login.headers }) }
);
const res = await this.loginPromise;
const data = this.getProperty(res, "login");
Expand All @@ -115,7 +115,10 @@ export class Auth implements AuthService {
this.config.endpoints.user.method,
this.config.endpoints.user.url,
undefined,
{ auth: true, headers: this.config.endpoints.user.headers }
{
auth: true,
headers: new Headers({ ...this.config.endpoints.user.headers }),
}
);
const res = await this.fetchUserPromise;
const data = this.getProperty(res, "user");
Expand All @@ -136,7 +139,7 @@ export class Auth implements AuthService {
this.config.endpoints.logout.method,
this.config.endpoints.logout.url,
undefined,
{ headers: this.config.endpoints.logout.headers }
{ headers: new Headers({ ...this.config.endpoints.logout.headers }) }
);
await this.logoutPromise;
}
Expand Down Expand Up @@ -204,6 +207,6 @@ export class Auth implements AuthService {
this.config.token.type
} ${this.storage.refreshToken()}`.trim();
}
return headers;
return new Headers(headers);
}
}

0 comments on commit 4aad9d4

Please sign in to comment.