mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-10-12 22:44:14 +00:00
22 lines
543 B
TypeScript
22 lines
543 B
TypeScript
"use server";
|
|
|
|
import { apiBaseUrl } from "@/lib";
|
|
import { getAuthHeaders } from "@/lib/auth-headers";
|
|
import { handleApiError, handleApiResponse } from "@/lib/server-actions-helper";
|
|
|
|
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);
|
|
}
|
|
};
|