add upvote count, fix loading issues
This commit is contained in:
parent
55455c1693
commit
cd92a4b12e
4 changed files with 70 additions and 1 deletions
|
|
@ -1,7 +1,8 @@
|
|||
import { backend, type GuildEntry, type PostEntry } from '$lib/backend.js';
|
||||
import { getMe } from '$lib/globals.svelte.js';
|
||||
import { getMe, sleep } from '$lib/globals.svelte.js';
|
||||
import type { LoadEvent } from '@sveltejs/kit';
|
||||
|
||||
let isFirstLoad = false;
|
||||
|
||||
async function loadFeed (event: LoadEvent): Promise<PostEntry[] | null> {
|
||||
const resp = await backend.withEvent(event).fetch('home/feed');
|
||||
|
|
@ -40,6 +41,12 @@ async function loadTopGuilds (event: LoadEvent): Promise<GuildEntry[] | null> {
|
|||
}
|
||||
|
||||
export async function load(event): Promise<{feed: PostEntry[] | null, top_guilds?: GuildEntry[] | null}> {
|
||||
// delay loading after layout
|
||||
if (!isFirstLoad) {
|
||||
await sleep(2000);
|
||||
isFirstLoad = true;
|
||||
}
|
||||
|
||||
let feed = null;
|
||||
let me = getMe();
|
||||
let top_guilds = null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue