Skip to content

Commit

Permalink
fix dashboard urls
Browse files Browse the repository at this point in the history
  • Loading branch information
arch1995 committed Dec 12, 2024
1 parent 41737fb commit c576b06
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/core/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ export class Auth {
if (!options.sdkUrl && !options.useMpc) {
if (options.buildEnv === BUILD_ENV.DEVELOPMENT) {
options.sdkUrl = "http://localhost:3000";
options.dashboardUrl = "http://localhost:5173/wallet/account";
options.dashboardUrl = "http://localhost:5173";
} else if (options.buildEnv === BUILD_ENV.STAGING) {
options.sdkUrl = "https://staging-auth.web3auth.io";
options.dashboardUrl = "https://staging-account.web3auth.io/wallet/account";
options.dashboardUrl = "https://staging-account.web3auth.io";
} else if (options.buildEnv === BUILD_ENV.TESTING) {
options.sdkUrl = "https://develop-auth.web3auth.io";
options.dashboardUrl = "https://develop-account.web3auth.io/wallet/account";
options.dashboardUrl = "https://develop-account.web3auth.io";
} else {
options.sdkUrl = "https://auth.web3auth.io";
options.dashboardUrl = "https://account.web3auth.io/wallet/account";
options.dashboardUrl = "https://account.web3auth.io";
}
}

Expand Down Expand Up @@ -129,6 +129,12 @@ export class Auth {
return `${this.options.sdkUrl}/v${version.split(".")[0]}`;
}

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

async init(): Promise<void> {
// get sessionNamespace from the redirect result.
const params = getHashQueryParams(this.options.replaceUrlOnRedirect);
Expand Down Expand Up @@ -303,7 +309,7 @@ export class Auth {
// in case of redirect mode, redirect url will be dapp specified
// in case of popup mode, redirect url will be sdk specified
const defaultParams = {
redirectUrl: this.options.dashboardUrl,
redirectUrl: `${this.dashboardUrl}/wallet/account`,
dappUrl: `${window.location.origin}${window.location.pathname}`,
};

Expand Down

0 comments on commit c576b06

Please sign in to comment.