diff --git a/src/lib/components/ui/layout/Shell.svelte b/src/lib/components/ui/layout/Shell.svelte index a845a8ce..cbb8a784 100644 --- a/src/lib/components/ui/layout/Shell.svelte +++ b/src/lib/components/ui/layout/Shell.svelte @@ -124,8 +124,6 @@ }) - -
- import { invalidate } from '$app/navigation' + import { invalidate, invalidateAll } from '$app/navigation' import { page } from '$app/state' import { fly } from 'svelte/transition' @@ -41,7 +41,7 @@ > {#each routes as route} invalidate(route.href)} + onclick={() => invalidateAll()} href={buildUrl(currentRoute, route.href)} class="font-medium rounded-full px-4 py-1 hover:bg-slate-200/40 hover:dark:bg-zinc-700/40 transition-colors duration-100 relative z-0 flex-shrink-0" diff --git a/src/routes/admin/+layout.ts b/src/routes/admin/+layout.ts index c5ac8dfe..8a76c40e 100644 --- a/src/routes/admin/+layout.ts +++ b/src/routes/admin/+layout.ts @@ -4,8 +4,6 @@ import { getClient } from '$lib/lemmy.js' import { site as siteStore } from '$lib/lemmy' export async function load({ fetch }) { - if (!profile) return - let { jwt } = profile! let site = get(siteStore) if (!site) { diff --git a/src/routes/comment/[instance]/[id]/+page.ts b/src/routes/comment/[instance]/[id]/+page.ts index 76e90416..a126a718 100644 --- a/src/routes/comment/[instance]/[id]/+page.ts +++ b/src/routes/comment/[instance]/[id]/+page.ts @@ -1,7 +1,5 @@ -import { profile } from '$lib/auth.svelte' import { client } from '$lib/lemmy.js' import { redirect } from '@sveltejs/kit' -import { get } from 'svelte/store' export async function load({ params, fetch }) { const comment = await client({ diff --git a/src/routes/inbox/+page.ts b/src/routes/inbox/+page.ts index 04d8bc98..7ce57134 100644 --- a/src/routes/inbox/+page.ts +++ b/src/routes/inbox/+page.ts @@ -11,8 +11,7 @@ import { get } from 'svelte/store' type InboxFeedType = 'replies' | 'mentions' | 'messages' | 'all' export async function load({ url, fetch }) { - const auth = profile - if (!auth?.jwt) return + if (!profile.data.jwt) return const type: InboxFeedType = (url.searchParams.get('type') as InboxFeedType) || 'all' diff --git a/src/routes/instances/+page.ts b/src/routes/instances/+page.ts index 6b63ab84..8c62e6ae 100644 --- a/src/routes/instances/+page.ts +++ b/src/routes/instances/+page.ts @@ -1,6 +1,4 @@ -import { profile } from '$lib/auth.svelte' import { getClient } from '$lib/lemmy.js' -import { get } from 'svelte/store' export async function load({ fetch }) { return (await getClient(undefined, fetch).getFederatedInstances()) diff --git a/src/routes/moderation/+page.ts b/src/routes/moderation/+page.ts index 219069e3..6c638c97 100644 --- a/src/routes/moderation/+page.ts +++ b/src/routes/moderation/+page.ts @@ -37,7 +37,7 @@ export async function load({ url, fetch }) { unresolved_only: type == 'unread', } - const admin = profile.data?.user ? isAdmin(profile!.user!) : false + const admin = profile.data?.user ? isAdmin(profile!.data.user!) : false const [posts, comments, messages] = await Promise.all([ client.listPostReports({ diff --git a/src/routes/modlog/+page.ts b/src/routes/modlog/+page.ts index ad18d727..e0bd932e 100644 --- a/src/routes/modlog/+page.ts +++ b/src/routes/modlog/+page.ts @@ -1,4 +1,3 @@ -import { profile } from '$lib/auth.svelte' import { publishedToDate } from '$lib/components/util/date.js' import { getClient } from '$lib/lemmy.js' import type { diff --git a/src/routes/post/[instance]/[id=integer]/+page.ts b/src/routes/post/[instance]/[id=integer]/+page.ts index 58d9a96f..bce499b3 100644 --- a/src/routes/post/[instance]/[id=integer]/+page.ts +++ b/src/routes/post/[instance]/[id=integer]/+page.ts @@ -1,13 +1,8 @@ -import { browser } from '$app/environment' -import { env } from '$env/dynamic/public' -import { profile } from '$lib/auth.svelte' import CommunityCard from '$lib/components/lemmy/community/CommunityCard.svelte' import { getClient } from '$lib/lemmy.js' import { awaitIfServer } from '$lib/promise.js' import { SSR_ENABLED, settings } from '$lib/settings.svelte' -import { error } from '@sveltejs/kit' import type { GetComments } from 'lemmy-js-client' -import { get } from 'svelte/store' export async function load({ params, url, fetch }) { const thread = url.searchParams.get('thread') diff --git a/src/routes/profile/media/+page.ts b/src/routes/profile/media/+page.ts index 368a8b3e..a0aa2d08 100644 --- a/src/routes/profile/media/+page.ts +++ b/src/routes/profile/media/+page.ts @@ -1,7 +1,5 @@ import { profile } from '$lib/auth.svelte' import { client } from '$lib/lemmy.js' -import { error } from '@sveltejs/kit' -import { get } from 'svelte/store' export async function load({ fetch, url }) { const { jwt } = profile.data diff --git a/src/routes/profile/user/+page.ts b/src/routes/profile/user/+page.ts index e3d6cdb7..4ba00699 100644 --- a/src/routes/profile/user/+page.ts +++ b/src/routes/profile/user/+page.ts @@ -1,8 +1,6 @@ -import { profile } from '$lib/auth.svelte' import { getClient } from '$lib/lemmy.js' import { getItemPublished } from '$lib/lemmy/item.js' import type { SortType } from 'lemmy-js-client' -import { get } from 'svelte/store' export async function load({ url, fetch, parent }) { const page = Number(url.searchParams.get('page')) || 1 diff --git a/src/routes/saved/+page.ts b/src/routes/saved/+page.ts index 1f40710d..4ea94ec1 100644 --- a/src/routes/saved/+page.ts +++ b/src/routes/saved/+page.ts @@ -1,13 +1,6 @@ import { profile } from '$lib/auth.svelte' import { getClient } from '$lib/lemmy.js' -import type { - CommentSortType, - CommentView, - ListingType, - PostView, - SortType, -} from 'lemmy-js-client' -import { get } from 'svelte/store' +import type { CommentView, ListingType, PostView } from 'lemmy-js-client' function getSavedItemPublished(item: PostView | CommentView) { if ('comment' in item) { diff --git a/src/routes/u/[name]/+page.ts b/src/routes/u/[name]/+page.ts index 50b0216d..a94f9053 100644 --- a/src/routes/u/[name]/+page.ts +++ b/src/routes/u/[name]/+page.ts @@ -1,8 +1,6 @@ -import { profile } from '$lib/auth.svelte' import { getClient } from '$lib/lemmy.js' import { getItemPublished } from '$lib/lemmy/item.js' import type { SortType } from 'lemmy-js-client' -import { get } from 'svelte/store' export async function load({ params, url, fetch }) { const page = Number(url.searchParams.get('page')) || 1