mirror of
https://github.com/Stef-00012/Zipline-Android-App.git
synced 2025-05-11 18:35:58 +02:00
added table filtering & searching, added large view for folders, urls, users and invites, fixed ScrollView cutting on the end (caused by padding), added dropdown component, updated table to handle sort & search
This commit is contained in:
parent
b2b22c6bb8
commit
06b5c3bfe9
30 changed files with 2946 additions and 1112 deletions
|
@ -13,6 +13,11 @@ import type {
|
|||
export interface GetFilesOptions {
|
||||
id?: string;
|
||||
favorite?: boolean;
|
||||
sortBy?: "name" | "type" | "size" | "createdAt" | "favorite";
|
||||
order?: "asc" | "desc";
|
||||
perPage?: number;
|
||||
searchField?: "name" | "tags" | "type" | "id";
|
||||
searchQuery?: string;
|
||||
}
|
||||
// GET /api/user/files
|
||||
export async function getFiles(
|
||||
|
@ -26,10 +31,16 @@ export async function getFiles(
|
|||
|
||||
const params = new URLSearchParams({
|
||||
page: page,
|
||||
sortBy: options.sortBy || "createdAt",
|
||||
order: options.order || "desc",
|
||||
});
|
||||
|
||||
if (options.id) params.append("id", options.id);
|
||||
if (options.favorite) params.append("favorite", "true");
|
||||
if (options.perPage) params.append("perpage", String(options.perPage));
|
||||
if (options.searchField) params.append("searchField", options.searchField);
|
||||
if (options.searchQuery)
|
||||
params.append("searchQuery", encodeURIComponent(options.searchQuery));
|
||||
|
||||
try {
|
||||
const res = await axios.get(`${url}/api/user/files?${params}`, {
|
||||
|
|
|
@ -2,15 +2,28 @@ import type { APIURLs, APIURL } from "@/types/zipline";
|
|||
import axios, { type AxiosError } from "axios";
|
||||
import * as db from "@/functions/database";
|
||||
|
||||
interface GetURLsOptions {
|
||||
searchField?: "code" | "vanity" | "destination";
|
||||
searchQuery?: string;
|
||||
}
|
||||
// GET /user/urls
|
||||
export async function getURLs(): Promise<APIURLs | string> {
|
||||
export async function getURLs(
|
||||
options?: GetURLsOptions,
|
||||
): Promise<APIURLs | string> {
|
||||
const token = db.get("token");
|
||||
const url = db.get("url");
|
||||
|
||||
if (!url || !token) return "Invalid token or URL";
|
||||
|
||||
const searchParams = new URLSearchParams();
|
||||
|
||||
if (options?.searchField && options?.searchQuery) {
|
||||
searchParams.append("searchField", options.searchField);
|
||||
searchParams.append("searchQuery", options.searchQuery);
|
||||
}
|
||||
|
||||
try {
|
||||
const res = await axios.get(`${url}/api/user/urls`, {
|
||||
const res = await axios.get(`${url}/api/user/urls?${searchParams}`, {
|
||||
headers: {
|
||||
Authorization: token,
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue