Merge pull request #445 from mihaic195/fix/feedback-on-event-type-update
fix: add success modal on event-type updatepull/466/head
commit
c9ea8fd624
|
@ -2,6 +2,7 @@ import { GetServerSideProps } from "next";
|
||||||
import Head from "next/head";
|
import Head from "next/head";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
|
import Modal from "../../components/Modal";
|
||||||
import React, { useEffect, useRef, useState } from "react";
|
import React, { useEffect, useRef, useState } from "react";
|
||||||
import Select, { OptionBase } from "react-select";
|
import Select, { OptionBase } from "react-select";
|
||||||
import prisma from "@lib/prisma";
|
import prisma from "@lib/prisma";
|
||||||
|
@ -104,6 +105,7 @@ export default function EventTypePage({
|
||||||
availability,
|
availability,
|
||||||
}: Props): JSX.Element {
|
}: Props): JSX.Element {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const [successModalOpen, setSuccessModalOpen] = useState(false);
|
||||||
|
|
||||||
const inputOptions: OptionBase[] = [
|
const inputOptions: OptionBase[] = [
|
||||||
{ value: EventTypeCustomInputType.TEXT, label: "Text" },
|
{ value: EventTypeCustomInputType.TEXT, label: "Text" },
|
||||||
|
@ -235,7 +237,7 @@ export default function EventTypePage({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
router.push("/event-types");
|
setSuccessModalOpen(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function deleteEventTypeHandler(event) {
|
async function deleteEventTypeHandler(event) {
|
||||||
|
@ -268,6 +270,10 @@ export default function EventTypePage({
|
||||||
setSelectedCustomInput(undefined);
|
setSelectedCustomInput(undefined);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const closeSuccessModal = () => {
|
||||||
|
setSuccessModalOpen(false);
|
||||||
|
};
|
||||||
|
|
||||||
const updateLocations = (e) => {
|
const updateLocations = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
|
@ -841,6 +847,12 @@ export default function EventTypePage({
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
<Modal
|
||||||
|
heading="Event Type updated successfully"
|
||||||
|
description="Your event type has been updated successfully."
|
||||||
|
open={successModalOpen}
|
||||||
|
handleClose={closeSuccessModal}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="w-full sm:w-2/12 ml-2 px-4 mt-8 sm:mt-0 min-w-32">
|
<div className="w-full sm:w-2/12 ml-2 px-4 mt-8 sm:mt-0 min-w-32">
|
||||||
|
|
Loading…
Reference in New Issue