mirror of
https://github.com/TheRealOwenRees/echecsfrance.git
synced 2026-07-23 04:26:57 +00:00
add vague boilerplate code for generating PDF and passing back to browser
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user