fix: typecheck errors

feat/alby
Roland Bewick 2023-09-26 14:13:09 +07:00
parent d2b2af71b1
commit 895a5ad39a
2 changed files with 8 additions and 5 deletions

View File

@ -11,7 +11,7 @@ export const getServerSideProps = async (ctx: GetServerSidePropsContext) => {
const session = await getServerSession({ req, res }); const session = await getServerSession({ req, res });
if (!session?.user?.id) { if (!session?.user?.id) {
return res.status(401).json({ message: "You must be logged in to do this" }); return res.writeHead(401).end();
} }
const credentials = await prisma.credential.findFirst({ const credentials = await prisma.credential.findFirst({
@ -26,7 +26,10 @@ export const getServerSideProps = async (ctx: GetServerSidePropsContext) => {
lightningAddress: null, lightningAddress: null,
}; };
if (credentials?.key) { if (credentials?.key) {
const { account_lightning_address, account_email } = credentials.key; const { account_lightning_address, account_email } = credentials.key as {
account_lightning_address?: string;
account_email?: string;
};
if (account_lightning_address) { if (account_lightning_address) {
props.lightningAddress = account_lightning_address; props.lightningAddress = account_lightning_address;
} }

View File

@ -1,4 +1,4 @@
import type { InferGetStaticPropsType } from "next"; import type { InferGetServerSidePropsType } from "next";
import { Trans } from "next-i18next"; import { Trans } from "next-i18next";
import Link from "next/link"; import Link from "next/link";
import { useState } from "react"; import { useState } from "react";
@ -9,11 +9,11 @@ import { trpc } from "@calcom/trpc/react";
import { Button, Tooltip, showToast } from "@calcom/ui"; import { Button, Tooltip, showToast } from "@calcom/ui";
import { Clipboard } from "@calcom/ui/components/icon"; import { Clipboard } from "@calcom/ui/components/icon";
import type { getStaticProps } from "./_getStaticProps"; import type { getServerSideProps } from "./_getServerSideProps";
const MAKE = "make"; const MAKE = "make";
export default function MakeSetup({ inviteLink }: InferGetStaticPropsType<typeof getStaticProps>) { export default function MakeSetup({ inviteLink }: InferGetServerSidePropsType<typeof getServerSideProps>) {
const [newApiKeys, setNewApiKeys] = useState<Record<string, string>>({}); const [newApiKeys, setNewApiKeys] = useState<Record<string, string>>({});
const { t } = useLocale(); const { t } = useLocale();