Skip to content

Commit

Permalink
Added environment check
Browse files Browse the repository at this point in the history
  • Loading branch information
corbadoman committed Jan 19, 2024
1 parent 0bb6b95 commit 375797e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class SDK {
private validation: Validation;

constructor(config: Config) {
this.validateEnvironment();

this.axiosClient = this.createClient(config);

this.authToken = new AuthToken(this.axiosClient);
Expand Down Expand Up @@ -90,6 +92,13 @@ class SDK {
validations(): Validation {
return this.validation;
}

private validateEnvironment(): void {
const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
if (isBrowser) {
throw new Error('This SDK is not supported in browser environment');
}
}
}

export default SDK;

0 comments on commit 375797e

Please sign in to comment.