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 Apr 22, 2024
1 parent 24055b2 commit d536be5
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`.

## [0.2.0] - 2024-04-11

### Added
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 @@ -153,7 +152,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 d536be5

Please sign in to comment.