2021-08-27 12:35:20 +00:00
|
|
|
import Shell from "@components/Shell";
|
|
|
|
import SettingsShell from "@components/Settings";
|
|
|
|
import prisma from "@lib/prisma";
|
2021-09-03 20:51:21 +00:00
|
|
|
import { getSession } from "@lib/auth";
|
2021-06-16 12:44:25 +00:00
|
|
|
|
2021-08-02 17:29:34 +00:00
|
|
|
export default function Billing() {
|
2021-06-16 12:44:25 +00:00
|
|
|
return (
|
2021-08-02 14:10:24 +00:00
|
|
|
<Shell heading="Billing" subtitle="Manage your billing information and cancel your subscription.">
|
2021-06-16 12:44:25 +00:00
|
|
|
<SettingsShell>
|
2021-07-30 23:05:38 +00:00
|
|
|
<div className="py-6 lg:pb-8 lg:col-span-9">
|
2021-06-16 12:44:25 +00:00
|
|
|
<div className="my-6">
|
|
|
|
<iframe
|
2021-09-15 15:55:04 +00:00
|
|
|
src="https://cal.com/subscription-embed"
|
2021-08-02 14:10:24 +00:00
|
|
|
style={{ minHeight: 800, width: "100%", border: 0 }}
|
2021-06-16 12:44:25 +00:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</SettingsShell>
|
|
|
|
</Shell>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export async function getServerSideProps(context) {
|
2021-08-02 17:29:34 +00:00
|
|
|
const session = await getSession(context);
|
|
|
|
if (!session) {
|
|
|
|
return { redirect: { permanent: false, destination: "/auth/login" } };
|
|
|
|
}
|
2021-06-16 12:44:25 +00:00
|
|
|
|
2021-08-02 17:29:34 +00:00
|
|
|
const user = await prisma.user.findFirst({
|
|
|
|
where: {
|
|
|
|
email: session.user.email,
|
|
|
|
},
|
|
|
|
select: {
|
|
|
|
id: true,
|
|
|
|
username: true,
|
|
|
|
name: true,
|
|
|
|
email: true,
|
|
|
|
bio: true,
|
|
|
|
avatar: true,
|
|
|
|
timeZone: true,
|
|
|
|
weekStart: true,
|
|
|
|
},
|
|
|
|
});
|
2021-06-16 12:44:25 +00:00
|
|
|
|
2021-08-02 17:29:34 +00:00
|
|
|
return {
|
|
|
|
props: { user }, // will be passed to the page component as props
|
|
|
|
};
|
2021-07-30 23:05:38 +00:00
|
|
|
}
|