Skip to content
This repository was archived by the owner on Apr 2, 2024. It is now read-only.

Commit 3363a00

Browse files
authored
Stop cim create ticket form from being submitted multiple times (#261)
1 parent 7f9d6df commit 3363a00

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/custom-surf/components/cim/CreateForm.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ export default function CreateForm(props: IProps) {
4040
// userInputs = [{ preselectedInput }, ...userInputs];
4141
// }
4242
const promise = customApiClient.cimStartForm(formKey, userInputs).then(
43-
(form) => {
44-
handleSubmit(form);
43+
async (form) => {
44+
await handleSubmit(form);
4545
setFlash(intl.formatMessage({ id: `cim.flash.${formKey}` }));
4646
},
4747
(e) => {

src/custom-surf/pages/CreateServiceTicket.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,16 @@ import ApplicationContext from "utils/ApplicationContext";
2424
export default function CreateServiceTicket() {
2525
const { redirect, customApiClient } = useContext(ApplicationContext);
2626

27-
const handleSubmit = (userInputs: any) => {
27+
const handleSubmit = async (userInputs: any) => {
2828
const ticket: CreateServiceTicketPayload = {
2929
ims_pw_id: userInputs.ims_ticket.name,
3030
jira_ticket_id: userInputs.jira_ticket.ticket_id,
3131
title_nl: userInputs.jira_ticket.summary,
3232
type: userInputs.ticket_type,
3333
};
34-
customApiClient.cimCreateTicket(ticket).then((_) => redirect("/tickets"));
34+
return customApiClient.cimCreateTicket(ticket).then((_) => {
35+
redirect("/tickets");
36+
});
3537
};
3638

3739
return (

0 commit comments

Comments
 (0)