Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix dashboard urls #350

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading