diff --git a/.env b/.env index 61dc09cc..9f8a13d2 100644 --- a/.env +++ b/.env @@ -1,5 +1,5 @@ VITE_DISABLED_EDITORS=powerhouse/document-drive -VITE_RENOWN_URL=http://localhost:3000 +# VITE_RENOWN_URL=http://localhost:3000 VITE_DEFAULT_DRIVE_URL=https://apps.powerhouse.io/makerdao/switchboard/d/monetalis VITE_BASE_HREF=/ ASSET_URL=/ diff --git a/src/hooks/useLogin.ts b/src/hooks/useLogin.ts index 6da4c379..89b042c4 100644 --- a/src/hooks/useLogin.ts +++ b/src/hooks/useLogin.ts @@ -14,19 +14,22 @@ export const useLogin = () => { const login = useCallback(async () => { const connectId = await did(); - const url = `${RENOWN_URL}?connect=${encodeURIComponent(connectId)}&network=${RENOWN_NETWORK_ID}`; + const url = new URL(RENOWN_URL); + url.searchParams.set('connect', connectId); + url.searchParams.set('network', RENOWN_NETWORK_ID); setStatus('checking'); if (window.electronAPI) { const protocol = await window.electronAPI.protocol(); - await window.electronAPI.openURL(`${url}&deeplink=${protocol}`); + url.searchParams.set('deeplink', protocol); + await window.electronAPI.openURL(url.toString()); } else { - window - .open( - `${url}&returnUrl=${encodeURIComponent(`${window.location.origin}${window.location.pathname}`)}`, - '_self', - ) - ?.focus(); + const returnUrl = new URL( + window.location.pathname, + window.location.origin, + ); + url.searchParams.set('returnUrl', returnUrl.toJSON()); + window.open(url, '_self')?.focus(); } }, [did]); diff --git a/src/services/renown/constants.ts b/src/services/renown/constants.ts index e7324920..bfed8af0 100644 --- a/src/services/renown/constants.ts +++ b/src/services/renown/constants.ts @@ -1,5 +1,5 @@ export const RENOWN_URL = - (import.meta.env.VITE_RENOWN_URL as string) || 'https://renown.vercel.app/'; + (import.meta.env.VITE_RENOWN_URL as string) || 'https://renown.vercel.app'; export const RENOWN_NETWORK_ID = (import.meta.env.VITE_RENOWN_NETWORK_ID as string) || '1';