confirming event gives no visual feedback (#804)

This commit is contained in:
Alex Johansson 2021-09-28 01:11:52 +01:00 committed by GitHub
parent 58dde562a3
commit dcea723ea4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,7 +4,6 @@ import { BanIcon, CalendarIcon, CheckIcon, ClockIcon, XIcon } from "@heroicons/r
import { DotsHorizontalIcon } from "@heroicons/react/solid"; import { DotsHorizontalIcon } from "@heroicons/react/solid";
import { BookingStatus } from "@prisma/client"; import { BookingStatus } from "@prisma/client";
import dayjs from "dayjs"; import dayjs from "dayjs";
import { useRouter } from "next/router";
import { Fragment } from "react"; import { Fragment } from "react";
import classNames from "@lib/classNames"; import classNames from "@lib/classNames";
@ -20,8 +19,6 @@ export default function Bookings() {
const query = trpc.useQuery(["viewer.bookings"]); const query = trpc.useQuery(["viewer.bookings"]);
const bookings = query.data; const bookings = query.data;
const router = useRouter();
async function confirmBookingHandler(booking: { id: number }, confirm: boolean) { async function confirmBookingHandler(booking: { id: number }, confirm: boolean) {
const res = await fetch("/api/book/confirm", { const res = await fetch("/api/book/confirm", {
method: "PATCH", method: "PATCH",
@ -31,7 +28,7 @@ export default function Bookings() {
}, },
}); });
if (res.ok) { if (res.ok) {
await router.replace(router.asPath); await query.refetch();
} }
} }