Files
prowler/ui/actions/task/tasks.ts
2025-09-02 10:12:03 +02:00

25 lines
469 B
TypeScript

"use server";
import {
apiBaseUrl,
getAuthHeaders,
handleApiError,
handleApiResponse,
} from "@/lib";
export const getTask = async (taskId: string) => {
const headers = await getAuthHeaders({ contentType: false });
const url = new URL(`${apiBaseUrl}/tasks/${taskId}`);
try {
const response = await fetch(url.toString(), {
headers,
});
return handleApiResponse(response);
} catch (error) {
return handleApiError(error);
}
};