feat: follow requests in sidebar

This commit is contained in:
mae taylor 2025-07-14 17:42:20 +01:00
parent 0dd903a4eb
commit 6f446fd871
Signed by: mae
GPG key ID: 3C80D76BA7A3B9BD
6 changed files with 117 additions and 3 deletions

24
src/lib/followRequests.js Normal file
View file

@ -0,0 +1,24 @@
import { server } from './client/server.js';
import { writable } from "svelte/store";
import * as api from "./api.js";
import { app } from './client/app.js';
import { get } from 'svelte/store';
// Cache for all requests
export let followRequests = writable();
/**
* Gets all follow requests
* @param {boolean} force
*/
export async function fetchFollowRequests(force) {
// if already cached, return for now
if(!get(followRequests) && !force) return;
let newReqs = await api.getFollowRequests(
get(server).host,
get(app).token
);
followRequests.set(newReqs);
}