feat: filtro de tickets por uno, varios o todos los estados

This commit is contained in:
Nurfog committed 2026-10-13 10:56:48 -03:00
1 parent c702a19c1e
commit 9e3c7b8059
2 files changed
+161 -25

No files matched your search

+10 -3
View File
@@ -41,7 +41,7 @@ export async function getMe() {
// ==================== Tickets ====================
export async function getTickets(params?: {
status?: string;
status?: string | string[];
priority?: string;
assigneeId?: number;
requesterId?: number;
@@ -53,8 +53,15 @@ export async function getTickets(params?: {
const query = new URLSearchParams();
if (params) {
Object.entries(params).forEach(([key, value]) => {
if (value !== undefined && value !== "" && value !== null)
query.set(key, String(value));
if (value === undefined || value === "" || value === null) return;
// El filtro de estados acepta uno o varios: se envía como lista
// separada por comas (ej: status=Open,Resolved). Vacío = Todos.
if (Array.isArray(value)) {
if (value.length === 0) return;
query.set(key, value.join(","));
return;
}
query.set(key, String(value));
});
}
return fetchApi<TicketListResult>(`/api/helpdesk/tickets?${query.toString()}`);