add vague boilerplate code for generating PDF and passing back to browser

This commit is contained in:
2025-12-10 16:16:01 +01:00
parent 432baf4c7c
commit b73ec6afc0
5 changed files with 480 additions and 6 deletions
+20 -1
View File
@@ -32,10 +32,29 @@ const MatchForm = ({ clubs }: IProps) => {
});
const onSubmit = async (data: MatchFormValues) => {
console.log("submitting form with data: ", data);
try {
await generateFeuilleDeMatch(data);
// // Destructure the result from the safe action
// const result = await generateFeuilleDeMatch(data);
//
// if (result?.data?.pdfBase64) {
// // 1. Convert Base64 to Blob
// const byteCharacters = atob(result.data.pdfBase64);
// const byteNumbers = new Array(byteCharacters.length);
// for (let i = 0; i < byteCharacters.length; i++) {
// byteNumbers[i] = byteCharacters.charCodeAt(i);
// }
// const byteArray = new Uint8Array(byteNumbers);
// const blob = new Blob([byteArray], { type: "application/pdf" });
//
// // 2. Create URL
// const url = URL.createObjectURL(blob);
//
// // 3. Open in new tab
// window.open(url, "_blank");
// }
setResponseMessage({
type: "success",
message: "generated feuille de match",