Fixed GoogleAuth and clearMessages again and updated the routing and navigation

This commit is contained in:
Samuel Andert
2023-07-27 12:41:56 +02:00
parent e2ea57e89f
commit 1ce7b80c9b
13 changed files with 170 additions and 111 deletions

View File

@ -5,8 +5,10 @@
import { ProviderType } from '@lit-protocol/constants';
import { createMessage } from '$lib/services/messages/messages';
import { createLitSession } from '$lib/services/createLitSession/createLitSession';
import Icon from '@iconify/svelte';
import Apps from '$lib/components/Apps.svelte';
const redirectUri = 'http://localhost:5173/login/';
const redirectUri = 'http://localhost:5173/';
export let services;
@ -109,37 +111,42 @@
}
</script>
<main>
{#if error}
<h1>Error</h1>
<p>{error.message}</p>
<button on:click={resetView}>Got it</button>
{:else if isLoading}
<h1>Loading...</h1>
{:else if view === 'sign_in'}
<h1>Sign in with Lit</h1>
<button on:click={authWithGoogle}>Google</button>
{:else if view === 'fetching'}
<h1>Fetching your PKPs...</h1>
{:else if view === 'NO_PKPS'}
<h1>No PKPs found.</h1>
<button on:click={mint}>Mint a PKP</button>
{:else if view === 'fetched'}
<h1>Select a PKP to continue</h1>
{#each pkps as pkp}
<button on:click={async () => await createSession(pkp)}>{pkp.ethAddress}</button>
{/each}
{:else if view === 'MINTING'}
<h1>Minting your PKP...</h1>
{:else if view === 'MINTED'}
<h1>Minted!</h1>
{:else if view === 'CREATING_SESSION'}
<h1>Creating session...</h1>
{:else if view === 'SESSION_CREATED'}
<h1>Ready for the open web</h1>
<div>
<p>Check out your PKP:</p>
<p>{currentPKP.ethAddress}</p>
</div>
{/if}
<main class="flex items-center justify-center h-full">
<div class="text-center">
{#if error}
<h1>Error</h1>
<p>{error.message}</p>
<button on:click={resetView}>Got it</button>
{:else if isLoading}
<h1>Loading...</h1>
{:else if view === 'sign_in'}
<button on:click={authWithGoogle} class="btn variant-filled">
<span><Icon icon="flat-color-icons:google" /></span>
<span>Sign in with Google</span>
</button>
{:else if view === 'fetching'}
<h1>Fetching your PKPs...</h1>
{:else if view === 'NO_PKPS'}
<h1>No PKPs found.</h1>
<button on:click={mint}>Mint a PKP</button>
{:else if view === 'fetched'}
<h1>Select a PKP to continue</h1>
{#each pkps as pkp}
<button on:click={async () => await createSession(pkp)}>{pkp.ethAddress}</button>
{/each}
{:else if view === 'MINTING'}
<h1>Minting your PKP...</h1>
{:else if view === 'MINTED'}
<h1>Minted!</h1>
{:else if view === 'CREATING_SESSION'}
<h1>Creating session...</h1>
{:else if view === 'SESSION_CREATED'}
<h1>Ready for the open web</h1>
<div>
<p>Check out your PKP:</p>
<p>{currentPKP.ethAddress}</p>
</div>
<Apps />
{/if}
</div>
</main>