fix commitment, do not send duplicate invites, disable buttons on working

This commit is contained in:
2025-09-19 23:00:54 +02:00
parent 1f9f2dc21c
commit 6c10027122
7 changed files with 139 additions and 101 deletions
@@ -25,6 +25,10 @@ public class ContactDataManager {
return contactDataRepository.findByContactAndReportedBy(contact, reportedBy).orElse(null); return contactDataRepository.findByContactAndReportedBy(contact, reportedBy).orElse(null);
} }
public ContactData findByContactAndEmail(Long contact, String email) {
return contactDataRepository.findByContactAndEmail(contact, email).orElse(null);
}
public ContactData findByinviteToken(String inviteToken) { public ContactData findByinviteToken(String inviteToken) {
return contactDataRepository.findByinviteToken(inviteToken).orElse(null); return contactDataRepository.findByinviteToken(inviteToken).orElse(null);
} }
@@ -65,8 +65,12 @@ public class ContactDataController {
inviteToken = ContactManager.generateToken(); inviteToken = ContactManager.generateToken();
} }
contactData.setInviteToken(inviteToken); contactData.setInviteToken(inviteToken);
if (contactDataManager.findByContactAndEmail(contact.getId(), contactData.getEmail()) == null) {
contactDataManager.sendInviteMail(contact, contactData, reportedBy); contactDataManager.sendInviteMail(contact, contactData, reportedBy);
} }
sendToken = false;
}
contactDataManager.save(contactData); contactDataManager.save(contactData);
@@ -33,7 +33,7 @@ public class FrontendController {
model.addAttribute("token", token); model.addAttribute("token", token);
model.addAttribute("userName", contact.getName()); model.addAttribute("userName", contact.getName());
model.addAttribute("altName", contact.getUpdatedName()); model.addAttribute("altName", contact.getUpdatedName());
model.addAttribute("altName", contact.getUpdatedName()); model.addAttribute("committed", contact.getCommitted());
ContactData contactData = contactDataManager.findByContactAndReportedBy(contact.getId(), ContactData contactData = contactDataManager.findByContactAndReportedBy(contact.getId(),
contact.getId()); contact.getId());
@@ -12,5 +12,7 @@ public interface ContactDataRepository extends JpaRepository<ContactData, Long>
Optional<ContactData> findByContactAndReportedBy(Long contact, Long reportedBy); Optional<ContactData> findByContactAndReportedBy(Long contact, Long reportedBy);
Optional<ContactData> findByContactAndEmail(Long contact, String email);
Optional<ContactData> findByinviteToken(String inviteToken); Optional<ContactData> findByinviteToken(String inviteToken);
} }
@@ -9,7 +9,7 @@
<h1>Hallo <span th:text="${contact.updatedName != null ? contact.updatedName : contact.name}"></span>!</h1> <h1>Hallo <span th:text="${contact.updatedName != null ? contact.updatedName : contact.name}"></span>!</h1>
<div> <div>
<p th:if="${contact.committed != null and contact.committed.name() == 'YES'}"> <p th:if="${contact.committed != null and contact.committed.name() == 'YES'}">
Super, dass du für unser 20-Jahres-Abitreffen am 13.11.2027 zugesagt hast - wir freuen uns sehr, dich dort wiederzusehen! Super, dass du für unser 20-Jahres-Abitreffen am 13.11.2027 in Gevelsberg zugesagt hast - wir freuen uns sehr, dich dort wiederzusehen!
</p> </p>
<p th:if="${contact.committed != null and contact.committed.name() == 'NO'}"> <p th:if="${contact.committed != null and contact.committed.name() == 'NO'}">
Schade, dass du im Moment nicht dabei bist. Du kannst deine Meinung aber jederzeit ändern. Schade, dass du im Moment nicht dabei bist. Du kannst deine Meinung aber jederzeit ändern.
+122 -94
View File
@@ -8,7 +8,7 @@
<script src="/lib/axios.min.js"></script> <script src="/lib/axios.min.js"></script>
<script defer src="/lib/alpinejs.min.js"></script> <script defer src="/lib/alpinejs.min.js"></script>
<link rel="stylesheet" href="/lib/bootstrap.min.css"> <link rel="stylesheet" href="/lib/bootstrap.min.css">
<link rel="stylesheet" href="/css/style.css" /> <link rel="stylesheet" href="/style.css" />
</head> </head>
<body> <body>
@@ -94,11 +94,12 @@
<input type="text" x-model="yourName" required autocomplete="off" <input type="text" x-model="yourName" required autocomplete="off"
class="form-control" autofocus /> class="form-control" autofocus />
</div> </div>
<button type="submit" class="btn btn-primary flex-fill">Suchen</button> <button type="submit" class="btn btn-primary flex-fill"
:class="{'disabled': working}">Suchen</button>
</form> </form>
</div> </div>
<div id="step1Msg" class="alert py-2" :class="'alert-' + step1MsgType" x-text="step1Msg" <div id="stepMsg" class="alert py-2" :class="'alert-' + stepMsgType" x-text="stepMsg"
x-show="step1Msg"></div> x-show="stepMsg"></div>
<div x-show="userName"> <div x-show="userName">
<form @submit.prevent="continueStep1"> <form @submit.prevent="continueStep1">
<p> <p>
@@ -123,7 +124,7 @@
<div id="step1ContinueDiv" class="d-flex gap-2 mt-3 justify-content-center" <div id="step1ContinueDiv" class="d-flex gap-2 mt-3 justify-content-center"
:class="userName ? '' : 'd-none'" x-transition> :class="userName ? '' : 'd-none'" x-transition>
<button id="step1ContinueBtn" type="submit" class="btn btn-primary flex-fill" <button id="step1ContinueBtn" type="submit" class="btn btn-primary flex-fill"
x-ref="continueBtn"> :class="{'disabled': working}" x-ref="continueBtn">
Weiter <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" Weiter <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"
viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
@@ -144,8 +145,8 @@
<rect x="2" y="4" width="20" height="16" rx="2"></rect> <rect x="2" y="4" width="20" height="16" rx="2"></rect>
</svg> Schritt 2: Deine Kontaktdaten </svg> Schritt 2: Deine Kontaktdaten
</h2> </h2>
<div id="step2Msg" class="alert py-2" :class="'alert-' + step2MsgType" x-text="step2Msg" <div id="stepMsg" class="alert py-2" :class="'alert-' + stepMsgType" x-text="stepMsg"
x-show="step2Msg"></div> x-show="stepMsg"></div>
<form @submit.prevent="submitContactData" class="mb-3" autocomplete="off"> <form @submit.prevent="submitContactData" class="mb-3" autocomplete="off">
<div class="mb-3"> <div class="mb-3">
<label class="form-label">E-Mail:</label> <label class="form-label">E-Mail:</label>
@@ -157,13 +158,14 @@
<input type="text" x-model="phone" autocomplete="off" class="form-control" /> <input type="text" x-model="phone" autocomplete="off" class="form-control" />
</div> </div>
<div class="d-flex gap-2"> <div class="d-flex gap-2">
<button type="button" class="btn btn-outline-secondary flex-fill" @click="step = 1"> <button type="button" class="btn btn-outline-secondary flex-fill"
:class="{'disabled': working}" @click="setStep(1)">
Zurück Zurück
</button> </button>
<button type="submit" class="btn btn-primary flex-fill" autofocus>Weiter <svg <button type="submit" class="btn btn-primary flex-fill" :class="{'disabled': working}"
xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" autofocus>Weiter <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
stroke-linejoin="round" aria-hidden="true"> stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="m9 18 6-6-6-6"></path> <path d="m9 18 6-6-6-6"></path>
</svg></button> </svg></button>
</div> </div>
@@ -187,11 +189,12 @@
class="form-control" autofocus /> class="form-control" autofocus />
</div> </div>
<div class="d-flex gap-2"> <div class="d-flex gap-2">
<button type="submit" class="btn btn-outline-dark flex-fill" autofocus>Suchen</button> <button type="submit" class="btn btn-outline-dark flex-fill"
:class="{'disabled': working}" autofocus>Suchen</button>
</div> </div>
</form> </form>
<div id="step3Msg" class="alert py-2" :class="'alert-' + step3MsgType" x-text="step3Msg" <div id="stepMsg" class="alert py-2" :class="'alert-' + stepMsgType" x-text="stepMsg"
x-show="step3Msg"></div> x-show="stepMsg"></div>
<div id="knownContactDataDiv" x-show="showKnownContactData" x-transition> <div id="knownContactDataDiv" x-show="showKnownContactData" x-transition>
<form @submit.prevent="submitKnownContactData" class="mb-3"> <form @submit.prevent="submitKnownContactData" class="mb-3">
<div class="mb-3"> <div class="mb-3">
@@ -205,7 +208,7 @@
class="form-control" /> class="form-control" />
</div> </div>
<button type="submit" class="btn btn-outline-success flex-fill" <button type="submit" class="btn btn-outline-success flex-fill"
autofocus>Speichern</button> :class="{'disabled': working}" autofocus>Speichern</button>
</form> </form>
</div> </div>
<ul class="list-group mb-3" id="enteredContacts"> <ul class="list-group mb-3" id="enteredContacts">
@@ -215,13 +218,14 @@
</template> </template>
</ul> </ul>
<div class="d-flex gap-2 mt-3 justify-content-center"> <div class="d-flex gap-2 mt-3 justify-content-center">
<button type="button" class="btn btn-outline-secondary flex-fill" @click="step = 2"> <button type="button" class="btn btn-outline-secondary flex-fill"
:class="{'disabled': working}" @click="setStep(2)">
Zurück Zurück
</button> </button>
<button id="step3NextBtn" class="btn btn-primary flex-fill" @click="step = 4">Weiter <svg <button id="step3NextBtn" class="btn btn-primary flex-fill" :class="{'disabled': working}"
xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" @click="setStep(4)">Weiter <svg xmlns="http://www.w3.org/2000/svg" width="24"
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
stroke-linejoin="round" aria-hidden="true"> stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="m9 18 6-6-6-6"></path> <path d="m9 18 6-6-6-6"></path>
</svg></button> </svg></button>
</div> </div>
@@ -236,22 +240,27 @@
<line x1="16" y1="2" x2="16" y2="6"></line> <line x1="16" y1="2" x2="16" y2="6"></line>
<line x1="8" y1="2" x2="8" y2="6"></line> <line x1="8" y1="2" x2="8" y2="6"></line>
<line x1="3" y1="10" x2="21" y2="10"></line> <line x1="3" y1="10" x2="21" y2="10"></line>
</svg> Schritt 4: Bist du beim 20-Jahrestreffen am 13.11.2027 dabei? </svg> Schritt 4: Bist du beim 20-Jahrestreffen am 13.11.2027 in Gevelsberg dabei?
</h2> </h2>
<div id="step4Msg" class="alert py-2" :class="'alert-' + step4MsgType" x-text="step4Msg" <div id="stepMsg" class="alert py-2" :class="'alert-' + stepMsgType" x-text="stepMsg"
x-show="step4Msg"></div> x-show="stepMsg"></div>
<p> <p x-show="!stepMsg">
Hast du Lust, am Samstag, den 13.11.2027, beim Nachtreffen dabei zu sein? Mehr Infos gibt's Hast du Lust, am Samstag, den 13.11.2027, beim Nachtreffen in Gevelsberg dabei zu sein?
dann hier und per Mail. Genauere Infos und Details gibt's dann später hier und per Mail.
</p> </p>
<div class="d-flex gap-2 mb-3"> <div class="d-flex gap-2 mb-3">
<button id="commitYes" class="btn btn-success flex-fill" @click="submitCommit('YES')" <button x-show="!stepMsg" id="commitYes" class="btn flex-fill"
autofocus>Ja, ich bin dabei!</button> :class="{'btn-success': committed != 'NO', 'btn-outline-dark' : committed == 'NO', 'disabled': working}"
<button id="commitNo" class="btn btn-danger flex-fill" @click="submitCommit('NO')">Nein, ich @click="submitCommit('YES')" autofocus>Ja, ich bin dabei!</button>
<button x-show="!stepMsg" id="commitNo" class="btn flex-fill"
:class="{'btn-danger' : committed != 'YES','btn-outline-dark' : committed == 'YES', 'disabled': working}"
@click="submitCommit('NO')">Nein,
ich
kann leider nicht</button> kann leider nicht</button>
</div> </div>
<div class="d-flex mt-2"> <div class="d-flex mt-2">
<button type="button" class="btn btn-outline-secondary flex-fill" @click="step = 3"> <button type="button" class="btn btn-outline-secondary flex-fill"
:class="{'disabled': working}" @click="setStep(3)">
Zurück Zurück
</button> </button>
</div> </div>
@@ -268,10 +277,11 @@
return { return {
// Step state // Step state
step: 1, step: 1,
stepMsg: '',
stepMsgType: '',
working: false,
// Step 1 // Step 1
yourName: '', yourName: '',
step1Msg: '',
step1MsgType: '',
altNameChecked: false, altNameChecked: false,
altName: '[[${altName}]]', altName: '[[${altName}]]',
showStep1Continue: false, showStep1Continue: false,
@@ -281,62 +291,72 @@
// Step 2 // Step 2
email: '[[${email}]]', email: '[[${email}]]',
phone: '[[${phone}]]', phone: '[[${phone}]]',
step2Msg: '',
step2MsgType: '',
// Step 3 // Step 3
knownContactName: '', knownContactName: '',
knownContactEmail: '', knownContactEmail: '',
knownContactPhone: '', knownContactPhone: '',
showKnownContactData: false, showKnownContactData: false,
enteredContacts: [], enteredContacts: [],
step3Msg: '', foundKnownContactName: null,
step3MsgType: '',
foundKnownContactName: null, // <-- add this line
// Step 4 // Step 4
step4Msg: '', committed: '[[${committed}]]',
step4MsgType: '',
// Methods // Methods
async findSelf() { async findSelf() {
this.step1Msg = ''; this.stepMsg = '';
this.step1MsgType = ''; this.stepMsgType = '';
this.altNameChecked = false; this.altNameChecked = false;
this.altName = ''; this.altName = '';
this.pendingUpdatedName = null; this.pendingUpdatedName = null;
try { try {
this.working = true;
const resp = await axios.get(`/api/v1/contact`, { params: { name: this.yourName.trim() }, validateStatus: () => true }); const resp = await axios.get(`/api/v1/contact`, { params: { name: this.yourName.trim() }, validateStatus: () => true });
if (resp.status === 200) { if (resp.status === 200) {
this.userName = resp.data.name; this.userName = resp.data.name;
this.userToken = resp.data.token || null; this.userToken = resp.data.token || null;
} else if (resp.status === 404) { } else if (resp.status === 404) {
this.step1Msg = 'Sorry, wir konnten dich nicht finden. Schreib deinen Namen bitte genau so, wie er auf dem Abi-T-Shirt stand!'; this.stepMsg = 'Sorry, wir konnten dich nicht finden. Schreib deinen Namen bitte genau so, wie er auf dem Abi-T-Shirt stand!';
this.step1MsgType = 'warning'; this.stepMsgType = 'warning';
} else if (resp.status === 208) { } else if (resp.status === 208) {
this.step1Msg = 'Du hast deine Daten schon eingetragen. Danke dir!'; this.stepMsg = 'Du hast deine Daten schon eingetragen. Danke dir!';
this.step1MsgType = 'info'; this.stepMsgType = 'info';
// Prevent showing greeting/alt name UI // Prevent showing greeting/alt name UI
this.userName = null; this.userName = null;
} else { } else {
this.step1Msg = 'Uups, da ist was schiefgelaufen. Versuch es gleich nochmal!'; this.stepMsg = 'Uups, da ist was schiefgelaufen. Versuch es gleich nochmal!';
this.step1MsgType = 'danger'; this.stepMsgType = 'danger';
} }
} catch { } catch {
this.step1Msg = 'Uups, da ist was schiefgelaufen. Versuch es gleich nochmal!'; this.stepMsg = 'Uups, da ist was schiefgelaufen. Versuch es gleich nochmal!';
this.step1MsgType = 'danger'; this.stepMsgType = 'danger';
} }
this.working = false;
},
setStep(step) {
this.stepMsg = '';
this.stepMsgType = '';
this.step = step;
}, },
async continueStep1() { async continueStep1() {
this.pendingUpdatedName = this.altNameChecked ? this.altName.trim() : null; this.pendingUpdatedName = this.altNameChecked ? this.altName.trim() : null;
if (this.pendingUpdatedName && !this.userToken) { if (this.pendingUpdatedName && !this.userToken) {
this.working = true;
try {
await axios.post('/api/v1/contact', { await axios.post('/api/v1/contact', {
name: this.userName, name: this.userName,
updatedName: this.pendingUpdatedName updatedName: this.pendingUpdatedName
}); });
} catch {
this.stepMsg = 'Uups, da ist was schiefgelaufen. Versuch es gleich nochmal!';
this.stepMsgType = 'danger';
} }
this.step = 2; this.working = false;
}
this.setStep(2);
}, },
async submitContactData() { async submitContactData() {
this.step2Msg = ''; this.stepMsg = '';
this.step2MsgType = ''; this.stepMsgType = '';
this.working = true;
try { try {
const resp = await axios.post('/api/v1/contact/data', { const resp = await axios.post('/api/v1/contact/data', {
name: this.userName, name: this.userName,
@@ -345,26 +365,28 @@
phone: this.phone.trim() phone: this.phone.trim()
}, { validateStatus: () => true }); }, { validateStatus: () => true });
if (resp.status === 200 || resp.status === 201) { if (resp.status === 200 || resp.status === 201) {
this.step = 3; this.setStep(3);
} else if (resp.status === 400) { } else if (resp.status === 400) {
this.step2Msg = 'Bitte schau nochmal über deine Angaben da stimmt was nicht.'; this.stepMsg = 'Bitte schau nochmal über deine Angaben da stimmt was nicht.';
this.step2MsgType = 'warning'; this.stepMsgType = 'warning';
} else { } else {
this.step2Msg = 'Da ist was schiefgelaufen. Versuch es bitte nochmal!'; this.stepMsg = 'Da ist was schiefgelaufen. Versuch es bitte nochmal!';
this.step2MsgType = 'danger'; this.stepMsgType = 'danger';
} }
} catch { } catch {
this.step2Msg = 'Da ist was schiefgelaufen. Versuch es bitte nochmal!'; this.stepMsg = 'Da ist was schiefgelaufen. Versuch es bitte nochmal!';
this.step2MsgType = 'danger'; this.stepMsgType = 'danger';
} }
this.working = false;
}, },
async findKnownContact() { async findKnownContact() {
this.step3Msg = ''; this.stepMsg = '';
this.step3MsgType = ''; this.stepMsgType = '';
this.showKnownContactData = false; this.showKnownContactData = false;
this.knownContactEmail = ''; this.knownContactEmail = '';
this.knownContactPhone = ''; this.knownContactPhone = '';
this.foundKnownContactName = null; // reset this.foundKnownContactName = null;
this.working = true;
try { try {
const resp = await axios.get('/api/v1/contact', { const resp = await axios.get('/api/v1/contact', {
params: { name: this.knownContactName.trim() }, params: { name: this.knownContactName.trim() },
@@ -373,35 +395,37 @@
if (resp.status === 200) { if (resp.status === 200) {
this.foundKnownContactName = resp.data.name.trim(); this.foundKnownContactName = resp.data.name.trim();
if (this.foundKnownContactName == this.yourName) { if (this.foundKnownContactName == this.yourName) {
this.step3Msg = 'Das bist du selbst deine Daten hast du ja schon eingetragen!'; this.stepMsg = 'Das bist du selbst deine Daten hast du ja schon eingetragen!';
this.step3MsgType = 'warning'; this.stepMsgType = 'warning';
this.showKnownContactData = false; this.showKnownContactData = false;
this.knownContactName = '' this.knownContactName = ''
return; return;
} }
this.knownContactName = this.foundKnownContactName; this.knownContactName = this.foundKnownContactName;
this.step3Msg = 'Super, trag bitte die Kontaktdaten ein!'; this.stepMsg = 'Super, trag bitte die Kontaktdaten ein!';
this.step3MsgType = 'success'; this.stepMsgType = 'success';
this.showKnownContactData = true; this.showKnownContactData = true;
} else if (resp.status === 404) { } else if (resp.status === 404) {
this.step3Msg = 'Diesen Namen gibt es leider nicht in unserer Liste.'; this.stepMsg = 'Diesen Namen gibt es leider nicht in unserer Liste.';
this.step3MsgType = 'warning'; this.stepMsgType = 'warning';
} else if (resp.status === 208) { } else if (resp.status === 208) {
this.step3Msg = 'Für diese Person haben wir schon Kontaktdaten. Danke trotzdem fürs Mitmachen!'; this.stepMsg = 'Für diese Person haben wir schon Kontaktdaten. Danke trotzdem fürs Mitmachen!';
this.step3MsgType = 'info'; this.stepMsgType = 'info';
this.showKnownContactData = false; this.showKnownContactData = false;
} else { } else {
this.step3Msg = 'Da ist was schiefgelaufen. Versuch es bitte nochmal!'; this.stepMsg = 'Da ist was schiefgelaufen. Versuch es bitte nochmal!';
this.step3MsgType = 'danger'; this.stepMsgType = 'danger';
} }
} catch { } catch {
this.step3Msg = 'Da ist was schiefgelaufen. Versuch es bitte nochmal!'; this.stepMsg = 'Da ist was schiefgelaufen. Versuch es bitte nochmal!';
this.step3MsgType = 'danger'; this.stepMsgType = 'danger';
} }
this.working = false;
}, },
async submitKnownContactData() { async submitKnownContactData() {
this.step3Msg = ''; this.stepMsg = '';
this.step3MsgType = ''; this.stepMsgType = '';
this.working = true;
try { try {
const resp = await axios.post('/api/v1/contact/data', { const resp = await axios.post('/api/v1/contact/data', {
name: this.foundKnownContactName, name: this.foundKnownContactName,
@@ -416,45 +440,49 @@
email: this.knownContactEmail.trim(), email: this.knownContactEmail.trim(),
phone: this.knownContactPhone.trim() phone: this.knownContactPhone.trim()
}); });
this.step3Msg = 'Danke, die Kontaktdaten sind gespeichert! Du kannst noch mehr eintragen oder einfach weitermachen.'; this.stepMsg = 'Danke, die Kontaktdaten sind gespeichert! Du kannst noch mehr eintragen oder einfach weitermachen.';
this.step3MsgType = 'success'; this.stepMsgType = 'success';
this.showKnownContactData = false; this.showKnownContactData = false;
this.knownContactName = ''; this.knownContactName = '';
this.foundKnownContactName = null; this.foundKnownContactName = null;
} else if (resp.status === 400) { } else if (resp.status === 400) {
this.step3Msg = 'Bitte prüfe die Angaben nochmal da stimmt was nicht.'; this.stepMsg = 'Bitte prüfe die Angaben nochmal da stimmt was nicht.';
this.step3MsgType = 'warning'; this.stepMsgType = 'warning';
} else { } else {
this.step3Msg = 'Da ist was schiefgelaufen. Versuch es bitte nochmal!'; this.stepMsg = 'Da ist was schiefgelaufen. Versuch es bitte nochmal!';
this.step3MsgType = 'danger'; this.stepMsgType = 'danger';
} }
} catch { } catch {
this.step3Msg = 'Da ist was schiefgelaufen. Versuch es bitte nochmal!'; this.stepMsg = 'Da ist was schiefgelaufen. Versuch es bitte nochmal!';
this.step3MsgType = 'danger'; this.stepMsgType = 'danger';
} }
this.working = false;
}, },
async submitCommit(committed) { async submitCommit(committed) {
this.working = true;
this.committed = committed;
try { try {
await axios.post('/api/v1/contact', { await axios.post('/api/v1/contact', {
name: this.userName, name: this.userName,
updatedName: this.pendingUpdatedName, updatedName: this.pendingUpdatedName,
token: this.userToken, token: this.userToken,
committed: committed committed: this.committed
}, { }, {
headers: this.userToken ? { 'Authorization': this.userToken } : {} headers: this.userToken ? { 'Authorization': this.userToken } : {}
}); });
if (committed == 'YES') { if (this.committed == 'YES') {
this.step4Msg = 'Danke für deine Rückmeldung! Schön, dass du dabei bist! Wir melden uns rechtzeitig mit allen weiteren Infos.' + (this.userToken ? '' : ' Du solltest schon automatisch eine E-Mail mit einem Link bekommen haben, über den du deine Daten jederzeit anpassen kannst.'); this.stepMsg = 'Danke für deine Rückmeldung! Schön, dass du dabei bist! Wir melden uns rechtzeitig mit allen weiteren Infos.' + (this.userToken ? '' : ' Du solltest schon automatisch eine E-Mail mit einem Link bekommen haben, über den du deine Daten jederzeit anpassen kannst.');
this.step4MsgType = 'success'; this.stepMsgType = 'success';
} else { } else if (this.committed == 'NO') {
this.step4Msg = 'Danke für deine Rückmeldung! Schade, dass du nicht dabei bist.' + (this.userToken ? '' : ' Du solltest trotzdem automatisch eine E-Mail mit einem Link bekommen haben, über den du deine Daten jederzeit anpassen kannst und auch noch zusagen kannst, solltest du doch noch kommen wollen.'); this.stepMsg = 'Danke für deine Rückmeldung! Schade, dass du nicht dabei bist.' + (this.userToken ? '' : ' Du solltest trotzdem automatisch eine E-Mail mit einem Link bekommen haben, über den du deine Daten jederzeit anpassen kannst und auch noch zusagen kannst, solltest du doch noch kommen wollen.');
this.step4MsgType = 'info'; this.stepMsgType = 'info';
} }
} catch { } catch {
this.step4Msg = 'Da ist was schiefgelaufen. Versuch es bitte nochmal!'; this.stepMsg = 'Da ist was schiefgelaufen. Versuch es bitte nochmal!';
this.step4MsgType = 'danger'; this.stepMsgType = 'danger';
} }
this.working = false;
} }
} }
} }