Fix a bunch of TypeScript errors
This commit is contained in:
parent
1b7c9cf359
commit
ea31607598
|
@ -1,4 +1,3 @@
|
|||
/* This example requires Tailwind CSS v2.0+ */
|
||||
import { Fragment, useState } from 'react'
|
||||
import { Dialog, Transition } from '@headlessui/react'
|
||||
import { CheckIcon } from '@heroicons/react/outline'
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
import { PrismaClient } from '@prisma/client';
|
||||
|
||||
let prisma: PrismaClient;
|
||||
const globalAny:any = global;
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
prisma = new PrismaClient();
|
||||
} else {
|
||||
if (!global.prisma) {
|
||||
global.prisma = new PrismaClient();
|
||||
if (!globalAny.prisma) {
|
||||
globalAny.prisma = new PrismaClient();
|
||||
}
|
||||
prisma = global.prisma;
|
||||
prisma = globalAny.prisma;
|
||||
}
|
||||
|
||||
export default prisma;
|
|
@ -84,16 +84,19 @@ export default function Type(props) {
|
|||
)];
|
||||
|
||||
// Handle date change
|
||||
useEffect(async () => {
|
||||
if(!selectedDate) {
|
||||
return
|
||||
useEffect(() => {
|
||||
const changeDate = async () => {
|
||||
if (!selectedDate) {
|
||||
return
|
||||
}
|
||||
|
||||
setLoading(true);
|
||||
const res = await fetch(`/api/availability/${user}?dateFrom=${lowerBound.utc().format()}&dateTo=${upperBound.utc().format()}`);
|
||||
const busyTimes = await res.json();
|
||||
if (busyTimes.length > 0) setBusy(busyTimes);
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
setLoading(true);
|
||||
const res = await fetch(`/api/availability/${user}?dateFrom=${lowerBound.utc().format()}&dateTo=${upperBound.utc().format()}`);
|
||||
const busyTimes = await res.json();
|
||||
if (busyTimes.length > 0) setBusy(busyTimes);
|
||||
setLoading(false);
|
||||
changeDate();
|
||||
}, [selectedDate]);
|
||||
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ export default function EventType(props) {
|
|||
const [ session, loading ] = useSession();
|
||||
const titleRef = useRef<HTMLInputElement>();
|
||||
const slugRef = useRef<HTMLInputElement>();
|
||||
const descriptionRef = useRef<HTMLInputElement>();
|
||||
const descriptionRef = useRef<HTMLTextAreaElement>();
|
||||
const lengthRef = useRef<HTMLInputElement>();
|
||||
const isHiddenRef = useRef<HTMLInputElement>();
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ export default function Availability(props) {
|
|||
const [showChangeTimesModal, setShowChangeTimesModal] = useState(false);
|
||||
const titleRef = useRef<HTMLInputElement>();
|
||||
const slugRef = useRef<HTMLInputElement>();
|
||||
const descriptionRef = useRef<HTMLInputElement>();
|
||||
const descriptionRef = useRef<HTMLTextAreaElement>();
|
||||
const lengthRef = useRef<HTMLInputElement>();
|
||||
const isHiddenRef = useRef<HTMLInputElement>();
|
||||
|
||||
|
@ -42,7 +42,7 @@ export default function Availability(props) {
|
|||
setShowChangeTimesModal(!showChangeTimesModal);
|
||||
}
|
||||
|
||||
const closeSuccessModal = () => { Router.reload(); }
|
||||
const closeSuccessModal = () => { router.replace(router.asPath); }
|
||||
|
||||
function convertMinsToHrsMins (mins) {
|
||||
let h = Math.floor(mins / 60);
|
||||
|
|
|
@ -15,7 +15,7 @@ export default function Settings(props) {
|
|||
const [successModalOpen, setSuccessModalOpen] = useState(false);
|
||||
const usernameRef = useRef<HTMLInputElement>();
|
||||
const nameRef = useRef<HTMLInputElement>();
|
||||
const descriptionRef = useRef<HTMLInputElement>();
|
||||
const descriptionRef = useRef<HTMLTextAreaElement>();
|
||||
const avatarRef = useRef<HTMLInputElement>();
|
||||
|
||||
const [ selectedTimeZone, setSelectedTimeZone ] = useState({ value: props.user.timeZone });
|
||||
|
|
Loading…
Reference in New Issue
Block a user