Skip to content

Commit

Permalink
refactor(sdk)!: make resetAccessToken() sync
Browse files Browse the repository at this point in the history
Change `MermaidChart#resetAccessToken()` so that it no longer returns a
`Promise`.
  • Loading branch information
aloisklink committed Dec 4, 2023
1 parent 8d6a1be commit 203aabc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 4 additions & 0 deletions packages/sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changes

- `MermaidChart#resetAccessToken()` no longer returns a `Promise`.

### Added

- Compile an ESM version of this codebase for Node.JS v18.
Expand Down
5 changes: 2 additions & 3 deletions packages/sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ export class MermaidChart {
this.axios.interceptors.response.use((res: AxiosResponse) => {
// Reset token if a 401 is thrown
if (res.status === 401) {
// don't care if this function rejects/resolves
void this.resetAccessToken();
this.resetAccessToken();
}
return res;
});
Expand Down Expand Up @@ -141,7 +140,7 @@ export class MermaidChart {
this.accessToken = accessToken;
}

public async resetAccessToken(): Promise<void> {
public resetAccessToken(): void {
this.accessToken = undefined;
this.axios.defaults.headers.common['Authorization'] = `Bearer none`;
}
Expand Down

0 comments on commit 203aabc

Please sign in to comment.