mirror of
https://github.com/formbricks/formbricks.git
synced 2026-01-01 11:20:26 -06:00
14 lines
373 B
TypeScript
14 lines
373 B
TypeScript
export const convertToCSV = async (data: { json: any; fields?: string[]; fileName?: string }) => {
|
|
const response = await fetch("/api/csv-conversion", {
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
},
|
|
body: JSON.stringify(data),
|
|
});
|
|
|
|
if (!response.ok) throw new Error("Failed to convert to CSV");
|
|
|
|
return response.json();
|
|
};
|