Modify the behavior of the download invitations button to send them via email
This commit is contained in:
parent
b4ec903ce0
commit
8f5c038f9c
@ -10,6 +10,8 @@ export interface Api<T extends Entity> {
|
|||||||
create(serializable: Serializable<T>, object: T, callback: (object: T) => void): void;
|
create(serializable: Serializable<T>, object: T, callback: (object: T) => void): void;
|
||||||
update(serializable: Serializable<T>, object: T, callback: () => void): void;
|
update(serializable: Serializable<T>, object: T, callback: () => void): void;
|
||||||
destroy(serializable: Serializable<T>, object: T, callback: () => void): void;
|
destroy(serializable: Serializable<T>, object: T, callback: () => void): void;
|
||||||
|
|
||||||
|
post(serializable: Serializable<T>, path: string, callback: () => void): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Serializable<T> {
|
export interface Serializable<T> {
|
||||||
@ -98,4 +100,14 @@ export class AbstractApi<T extends Entity> implements Api<T> {
|
|||||||
}).then(callback)
|
}).then(callback)
|
||||||
.catch((error) => console.error(error));
|
.catch((error) => console.error(error));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
post(serializable: Serializable<T>, path: string, callback: () => void): void {
|
||||||
|
fetch(`/api/${getSlug()}/${serializable.apiPath()}/${path}`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'X-CSRF-TOKEN': getCsrfToken(),
|
||||||
|
}
|
||||||
|
}).then(callback)
|
||||||
|
.catch((error) => console.error(error));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -146,9 +146,9 @@ export default function InvitationsBoard({ guests, invitations: originalInvitati
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleDownloadQrCodes() {
|
function handleDownloadQrCodes() {
|
||||||
api.getAllPdf(serializer, () => {
|
api.post(serializer, 'email', () => {
|
||||||
console.log("QR codes downloaded");
|
console.log("Email scheduled to be sent with QR codes.");
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -180,7 +180,7 @@ export default function InvitationsBoard({ guests, invitations: originalInvitati
|
|||||||
onClick={handleDownloadQrCodes}
|
onClick={handleDownloadQrCodes}
|
||||||
className={classNames('primary')}
|
className={classNames('primary')}
|
||||||
>
|
>
|
||||||
Download QR codes
|
Send QR codes via email
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user