mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-07-12 15:11:49 +00:00
25 lines
511 B
TypeScript
25 lines
511 B
TypeScript
"use server";
|
|
|
|
import {
|
|
apiBaseUrl,
|
|
getAuthHeaders,
|
|
getErrorMessage,
|
|
parseStringify,
|
|
} 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,
|
|
});
|
|
const data = await response.json();
|
|
return parseStringify(data);
|
|
} catch (error) {
|
|
return { error: getErrorMessage(error) };
|
|
}
|
|
};
|