Skip to content

Commit

Permalink
feat: use local replica url constant in demo
Browse files Browse the repository at this point in the history
  • Loading branch information
peterpeterparker committed Jan 30, 2025
1 parent 67e6521 commit 4368925
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 6 additions & 3 deletions demo/src/core/stores/auth.store.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import {
AUTH_MAX_TIME_TO_LIVE,
AUTH_POPUP_HEIGHT,
AUTH_POPUP_WIDTH
AUTH_POPUP_WIDTH,
LOCAL_REPLICA_URL
} from '$core/constants/app.constants';
import type { OptionIdentity } from '$core/types/identity';
import { createAuthClient } from '$core/utils/auth.utils';
Expand Down Expand Up @@ -56,11 +57,13 @@ const initAuthStore = (): AuthStore => {
const container = import.meta.env.VITE_CONTAINER;
const iiId = import.meta.env.VITE_INTERNET_IDENTITY_ID;

const localHost = URL.parse(LOCAL_REPLICA_URL);

const identityProvider =
nonNullish(container) && nonNullish(iiId)
? /apple/i.test(navigator?.vendor)
? `http://localhost:4943?canisterId=${iiId}`
: `http://${iiId}.localhost:4943`
? `${LOCAL_REPLICA_URL}?canisterId=${iiId}`
: `http://${iiId}.${localHost?.host ?? 'localhost:4943'}`
: `https://identity.${domain ?? 'ic0.app'}`;

await authClient?.login({
Expand Down
3 changes: 2 additions & 1 deletion demo/src/wallet_frontend/src/routes/sign/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import ConsentMessage from '$lib/ConsentMessage.svelte';
import GetICP from '$lib/GetICP.svelte';
import CallCanister from '$lib/CallCanister.svelte';
import { LOCAL_REPLICA_URL } from '$core/constants/app.constants';
let signer = $state<Signer | undefined>(undefined);
Expand All @@ -26,7 +27,7 @@
signer = Signer.init({
owner: $authStore.identity,
host: 'http://localhost:4943'
host: LOCAL_REPLICA_URL
});
return () => {
Expand Down

0 comments on commit 4368925

Please sign in to comment.