Skip to content

Commit

Permalink
dont return versioned urls if sdk url is passed
Browse files Browse the repository at this point in the history
  • Loading branch information
arch1995 committed Sep 27, 2023
1 parent 04e671b commit abb0136
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/openlogin/src/OpenLogin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,13 @@ class OpenLogin {

private dappState: string;

private addVersionInUrls = true;

constructor(options: OpenLoginOptions) {
if (!options.clientId) throw InitializationError.invalidParams("clientId is required");
if (!options.network) options.network = OPENLOGIN_NETWORK.SAPPHIRE_MAINNET;
if (!options.buildEnv) options.buildEnv = BUILD_ENV.PRODUCTION;
if (options.buildEnv === BUILD_ENV.DEVELOPMENT || options.buildEnv === BUILD_ENV.TESTING || options.sdkUrl) this.addVersionInUrls = false;
if (!options.sdkUrl && !options.useMpc) {
if (options.buildEnv === BUILD_ENV.DEVELOPMENT) {
options.sdkUrl = "http://localhost:3000";
Expand Down Expand Up @@ -114,7 +117,7 @@ class OpenLogin {

private get baseUrl(): string {
// testing and develop don't have versioning
if (this.options.buildEnv === BUILD_ENV.DEVELOPMENT || this.options.buildEnv === BUILD_ENV.TESTING) return `${this.options.sdkUrl}`;
if (!this.addVersionInUrls) return `${this.options.sdkUrl}`;
return `${this.options.sdkUrl}/v${version.split(".")[0]}`;
}

Expand Down

0 comments on commit abb0136

Please sign in to comment.