Skip to content

Commit

Permalink
Fixed profile links and redirect.
Browse files Browse the repository at this point in the history
  • Loading branch information
amyjko committed Oct 12, 2024
1 parent 844b7a6 commit 7b34d4e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/lib/Page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
</span>
{#if $navigating}<Loading inline={false} />{/if}
<span class="account"
>{#if $user}<Link to="/login">{$user.email}</Link>{:else}<Link to="/login">Login</Link
>{#if $user}<Link to="/person/{$user.id}">{$user.email}</Link>{:else}<Link to="/login"
>Login</Link
>{/if}</span
>
</div>
Expand Down
5 changes: 3 additions & 2 deletions src/routes/login/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,19 @@
async function login() {
submitting = true;
const { error } = await supabase.auth.verifyOtp({ email, token: code, type: 'email' });
const { data, error } = await supabase.auth.verifyOtp({ email, token: code, type: 'email' });
if (error) message = error.code ?? error.message;
else {
submitted = false;
message = null;
if (data.user?.id) goto(`/person/${data.user.id}`);
}
submitting = false;
}
// Already signed in? Go to the profile.
$: if (browser && $user) goto(`/person/${$user.id}`);
// $: if (browser && $user) goto(`/person/${$user.id}`);
$: emailActive = !submitting && validEmail(email);
Expand Down
2 changes: 1 addition & 1 deletion src/routes/person/[personid]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<Loading />
{:then orgs}
{#if orgs.data === null}
<Oops text="Couldn't load organizations" />
<Oops text="Couldn't load organizations: {orgs.error.message}" />
{:else if $user}
<Paragraph>Hi <strong>{$user.email}</strong>!</Paragraph>

Expand Down
2 changes: 1 addition & 1 deletion supabase/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ url = ""
skip_nonce_check = false

[analytics]
enabled = false
enabled = true
port = 54327
vector_port = 54328
# Configure one of the supported backends: `postgres`, `bigquery`.
Expand Down

0 comments on commit 7b34d4e

Please sign in to comment.