add min age notice (#9)
All checks were successful
delpoy / build-and-deploy (push) Successful in 40s

This commit is contained in:
bytedream 2023-11-30 19:41:44 +01:00
parent 09da379812
commit 4e16487d3d

View File

@ -39,6 +39,11 @@
async function sendRegister() {
// eslint-disable-next-line no-async-promise-executor
registerRequest = new Promise(async (resolve, reject) => {
if (birthdayInput.valueAsDate || new Date() > new Date(Date.now() - 1000 * 60 * 60 * 24 * 365 * 6)) {
reject(Error('Bitte gib deinen vollständigen Geburtstag und die korrekte Jahreszahl an. Du musst mindestens 6 Jahre alt sein.'))
return;
}
const response = await fetch(`${env.PUBLIC_BASE_PATH}/register`, {
method: 'POST',
body: new FormData(document.forms[0])