Fix invitation submitting.
This commit is contained in:
@@ -57,30 +57,29 @@ const RegForm = ({ history }: any) => {
|
|||||||
|
|
||||||
var decodedInvitationId = atob(id);
|
var decodedInvitationId = atob(id);
|
||||||
|
|
||||||
const onSubmit = (values: FormValues) => {
|
const onSubmit = async (values: FormValues) => {
|
||||||
let responseCode: string = '';
|
let responseCode: string = '';
|
||||||
values.visitors = values.visitors ?? [];
|
values.visitors = values.visitors ?? [];
|
||||||
|
|
||||||
values.visitors.map((visitor) => {
|
values.visitors.map(async (visitor) => {
|
||||||
addVisitor({
|
responseCode = await addVisitor({
|
||||||
...visitor,
|
...visitor,
|
||||||
allergies: visitor.allergies ? arrayToString(visitor.allergies) : '',
|
allergies: visitor.allergies ? arrayToString(visitor.allergies) : '',
|
||||||
preferences: visitor.preferences ?? '',
|
preferences: visitor.preferences ?? '',
|
||||||
welcomeDrink: visitor.welcomeDrink ?? '',
|
welcomeDrink: visitor.welcomeDrink ?? '',
|
||||||
invitationId: (visitor.invitationId = decodedInvitationId),
|
invitationId: (visitor.invitationId = decodedInvitationId),
|
||||||
}).then((res) => (responseCode = res));
|
});
|
||||||
|
|
||||||
return visitor;
|
return visitor;
|
||||||
});
|
});
|
||||||
|
|
||||||
submitInvitation(decodedInvitationId).then((res) => (responseCode = res));
|
responseCode = await submitInvitation(decodedInvitationId);
|
||||||
|
|
||||||
responseCode !== 'success' ? showError() : history.push('/confirmation');
|
responseCode !== 'success' ? showError() : history.push('/confirmation');
|
||||||
};
|
};
|
||||||
|
|
||||||
const onDecline = () => {
|
const onDecline = async () => {
|
||||||
let responseCode: string = '';
|
let responseCode: string = await submitInvitation(decodedInvitationId);
|
||||||
submitInvitation(decodedInvitationId).then((res) => (responseCode = res));
|
|
||||||
responseCode !== 'success' ? showError() : history.push('/confirmation');
|
responseCode !== 'success' ? showError() : history.push('/confirmation');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user