fixes user create redirect bug
This commit is contained in:
@@ -13,6 +13,7 @@
|
|||||||
import Dropdown from "./base/dropdown.svelte";
|
import Dropdown from "./base/dropdown.svelte";
|
||||||
import LogoTextLight from "./logo/logo_text_light.svelte";
|
import LogoTextLight from "./logo/logo_text_light.svelte";
|
||||||
import NotificationDropdown from "./notification/notification_dropdown.svelte";
|
import NotificationDropdown from "./notification/notification_dropdown.svelte";
|
||||||
|
import { browser } from "$app/environment";
|
||||||
|
|
||||||
let navBarItems = [
|
let navBarItems = [
|
||||||
{ text: "Home", value: "/" },
|
{ text: "Home", value: "/" },
|
||||||
@@ -89,6 +90,12 @@
|
|||||||
goto("/settings/profile");
|
goto("/settings/profile");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$: user = browser ? $currentUser : pb.authStore.model;
|
||||||
|
|
||||||
|
function loggedIn() {
|
||||||
|
return user !== null && user !== undefined;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Drawer bind:open={drawerOpen}>
|
<Drawer bind:open={drawerOpen}>
|
||||||
@@ -122,30 +129,28 @@
|
|||||||
</div>
|
</div>
|
||||||
<hr class="my-6 border-input-border" />
|
<hr class="my-6 border-input-border" />
|
||||||
<div class="flex flex-col basis-full">
|
<div class="flex flex-col basis-full">
|
||||||
{#if pb.authStore.model}
|
{#if user}
|
||||||
<a
|
<a class="btn-primary text-center mx-4" href="/trail/edit/new"
|
||||||
class="btn-primary text-center mx-4"
|
|
||||||
href="/trail/edit/new"
|
|
||||||
><i class="fa fa-plus mr-2"></i>{$_("new-trail")}</a
|
><i class="fa fa-plus mr-2"></i>{$_("new-trail")}</a
|
||||||
>
|
>
|
||||||
<div class="basis-full"></div>
|
<div class="basis-full"></div>
|
||||||
<hr class="border-input-border" />
|
<hr class="border-input-border" />
|
||||||
<div class="flex gap-4 items-center justify-between m-4">
|
<div class="flex gap-4 items-center justify-between m-4">
|
||||||
<a href="/profile/{pb.authStore.model.id}">
|
<a href="/profile/{user.id}">
|
||||||
<img
|
<img
|
||||||
class="rounded-full w-10 aspect-square"
|
class="rounded-full w-10 aspect-square"
|
||||||
src={getFileURL(
|
src={getFileURL(
|
||||||
pb.authStore.model,
|
user,
|
||||||
pb.authStore.model.avatar,
|
user.avatar,
|
||||||
) ||
|
) ||
|
||||||
`https://api.dicebear.com/7.x/initials/svg?seed=${pb.authStore.model.username}&backgroundType=gradientLinear`}
|
`https://api.dicebear.com/7.x/initials/svg?seed=${user.username}&backgroundType=gradientLinear`}
|
||||||
alt="avatar"
|
alt="avatar"
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
<a href="/profile/{pb.authStore.model.id}">
|
<a href="/profile/{user.id}">
|
||||||
<p class="text-sm">{pb.authStore.model.username}</p>
|
<p class="text-sm">{user.username}</p>
|
||||||
<p class="text-sm text-gray-500">
|
<p class="text-sm text-gray-500">
|
||||||
{pb.authStore.model.email}
|
{user.email}
|
||||||
</p>
|
</p>
|
||||||
</a>
|
</a>
|
||||||
<button
|
<button
|
||||||
@@ -186,7 +191,7 @@
|
|||||||
data-sveltekit-preload-data="off">{item.text}</a
|
data-sveltekit-preload-data="off">{item.text}</a
|
||||||
>
|
>
|
||||||
{/each}
|
{/each}
|
||||||
{#if pb.authStore.model}
|
{#if user}
|
||||||
<a
|
<a
|
||||||
class="font-semibold z-10"
|
class="font-semibold z-10"
|
||||||
href="/lists"
|
href="/lists"
|
||||||
@@ -195,7 +200,7 @@
|
|||||||
>
|
>
|
||||||
{/if}
|
{/if}
|
||||||
</menu>
|
</menu>
|
||||||
{#if pb.authStore.model}
|
{#if user}
|
||||||
<div class="hidden lg:flex gap-6 items-center">
|
<div class="hidden lg:flex gap-6 items-center">
|
||||||
<button
|
<button
|
||||||
class="btn-icon fa-regular fa-{$theme === 'light'
|
class="btn-icon fa-regular fa-{$theme === 'light'
|
||||||
@@ -222,10 +227,10 @@
|
|||||||
<img
|
<img
|
||||||
class="rounded-full w-full h-full"
|
class="rounded-full w-full h-full"
|
||||||
src={getFileURL(
|
src={getFileURL(
|
||||||
pb.authStore.model,
|
user,
|
||||||
pb.authStore.model.avatar,
|
user.avatar,
|
||||||
) ||
|
) ||
|
||||||
`https://api.dicebear.com/7.x/initials/svg?seed=${pb.authStore.model.username}&backgroundType=gradientLinear`}
|
`https://api.dicebear.com/7.x/initials/svg?seed=${user.username}&backgroundType=gradientLinear`}
|
||||||
alt="avatar"
|
alt="avatar"
|
||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user