share intent, other pages

This commit is contained in:
Stef-00012 2025-01-26 15:30:48 +01:00
parent a820c7d7e6
commit 5d4c788db9
No known key found for this signature in database
GPG key ID: 28BE9A9E4EF0E6BF
18 changed files with 616 additions and 174 deletions

View file

@ -8,8 +8,12 @@ import * as FileSystem from "expo-file-system";
import * as db from "@/functions/database";
import axios from "axios";
interface GetFilesOptions {
id?: string;
favorite?: boolean;
}
// GET /api/user/files
export async function getFiles(page: string): Promise<APIFiles | null> {
export async function getFiles(page: string, options: GetFilesOptions = {}): Promise<APIFiles | null> {
const token = db.get("token");
const url = db.get("url");
@ -19,6 +23,9 @@ export async function getFiles(page: string): Promise<APIFiles | null> {
page: page,
});
if (options.id) params.append("id", options.id);
if (options.favorite) params.append("favorite", "true");
try {
const res = await axios.get(`${url}/api/user/files?${params}`, {
headers: {

View file

@ -44,6 +44,7 @@ export async function createInvite(expiresAt?: string, maxUses?: number): Promis
return res.data;
} catch (e) {
console.error(e)
return null;
}
}