|
@@ -2,6 +2,7 @@
|
|
|
const EMAIL_STORAGE_KEY = 'ff_member_form_email_v1';
|
|
const EMAIL_STORAGE_KEY = 'ff_member_form_email_v1';
|
|
|
const DISCLAIMER_ACCEPTED_KEY = 'ff_member_form_disclaimer_accepted_v1';
|
|
const DISCLAIMER_ACCEPTED_KEY = 'ff_member_form_disclaimer_accepted_v1';
|
|
|
const boot = window.APP_BOOT || { steps: [], csrf: '', contactEmail: '' };
|
|
const boot = window.APP_BOOT || { steps: [], csrf: '', contactEmail: '' };
|
|
|
|
|
+ const baseUrl = String(boot.baseUrl || '').replace(/\/+$/, '');
|
|
|
|
|
|
|
|
const state = {
|
|
const state = {
|
|
|
email: '',
|
|
email: '',
|
|
@@ -33,6 +34,11 @@
|
|
|
const submitBtn = document.getElementById('submitBtn');
|
|
const submitBtn = document.getElementById('submitBtn');
|
|
|
const stepElements = Array.from(document.querySelectorAll('.step'));
|
|
const stepElements = Array.from(document.querySelectorAll('.step'));
|
|
|
|
|
|
|
|
|
|
+ function appUrl(path) {
|
|
|
|
|
+ const normalizedPath = String(path || '').replace(/^\/+/, '');
|
|
|
|
|
+ return (baseUrl ? baseUrl + '/' : '/') + normalizedPath;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
function setFeedback(text, isError) {
|
|
function setFeedback(text, isError) {
|
|
|
feedbackMessage.textContent = text || '';
|
|
feedbackMessage.textContent = text || '';
|
|
|
feedbackMessage.classList.toggle('error-text', Boolean(isError));
|
|
feedbackMessage.classList.toggle('error-text', Boolean(isError));
|
|
@@ -370,7 +376,7 @@
|
|
|
fd.append('csrf', boot.csrf);
|
|
fd.append('csrf', boot.csrf);
|
|
|
fd.append('email', email);
|
|
fd.append('email', email);
|
|
|
fd.append('website', '');
|
|
fd.append('website', '');
|
|
|
- return postForm('/api/load-draft.php', fd);
|
|
|
|
|
|
|
+ return postForm(appUrl('api/load-draft.php'), fd);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async function resetSavedData(email) {
|
|
async function resetSavedData(email) {
|
|
@@ -378,12 +384,12 @@
|
|
|
fd.append('csrf', boot.csrf);
|
|
fd.append('csrf', boot.csrf);
|
|
|
fd.append('email', email);
|
|
fd.append('email', email);
|
|
|
fd.append('website', '');
|
|
fd.append('website', '');
|
|
|
- return postForm('/api/reset.php', fd);
|
|
|
|
|
|
|
+ return postForm(appUrl('api/reset.php'), fd);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async function saveDraft(includeFiles) {
|
|
async function saveDraft(includeFiles) {
|
|
|
const payload = collectPayload(includeFiles);
|
|
const payload = collectPayload(includeFiles);
|
|
|
- const response = await postForm('/api/save-draft.php', payload);
|
|
|
|
|
|
|
+ const response = await postForm(appUrl('api/save-draft.php'), payload);
|
|
|
|
|
|
|
|
if (response.upload_errors && Object.keys(response.upload_errors).length > 0) {
|
|
if (response.upload_errors && Object.keys(response.upload_errors).length > 0) {
|
|
|
showErrors(response.upload_errors);
|
|
showErrors(response.upload_errors);
|
|
@@ -415,7 +421,7 @@
|
|
|
|
|
|
|
|
async function submitApplication() {
|
|
async function submitApplication() {
|
|
|
const payload = collectPayload(true);
|
|
const payload = collectPayload(true);
|
|
|
- const response = await postForm('/api/submit.php', payload);
|
|
|
|
|
|
|
+ const response = await postForm(appUrl('api/submit.php'), payload);
|
|
|
clearErrors();
|
|
clearErrors();
|
|
|
setDraftStatus('Abgeschlossen', false);
|
|
setDraftStatus('Abgeschlossen', false);
|
|
|
setFeedback('Antrag erfolgreich abgeschlossen. Vielen Dank.', false);
|
|
setFeedback('Antrag erfolgreich abgeschlossen. Vielen Dank.', false);
|