feat: follow requests in sidebar
This commit is contained in:
parent
0dd903a4eb
commit
6f446fd871
6 changed files with 117 additions and 3 deletions
24
src/lib/followRequests.js
Normal file
24
src/lib/followRequests.js
Normal 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);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue