Skip to content

Commit

Permalink
fix(rest-api-client): throw an error if location is undefined on br…
Browse files Browse the repository at this point in the history
…owser (#1590)

* fix(rest-api-client): throw an error if location undefined on browser

* chore: update error message
  • Loading branch information
tasshi-me authored Jun 27, 2022
1 parent a824861 commit adc67c5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/rest-api-client/src/platform/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,11 @@ export const buildBaseUrl = (baseUrl?: string) => {
return baseUrl;
}

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const { host, protocol } = location!;
if (location === undefined) {
throw new Error("The baseUrl parameter is required for this environment");
}

const { host, protocol } = location;

return `${protocol}//${host}`;
};
Expand Down

0 comments on commit adc67c5

Please sign in to comment.