import Head from 'next/head';
import Shell from '../../components/Shell';
import SettingsShell from '../../components/Settings';
import prisma from '../../lib/prisma';
import {getSession, useSession} from 'next-auth/client';
export default function Billing(props) {
const [ session, loading ] = useSession();
if (loading) {
return
Loading...
;
}
return (
Billing | Calendso
Change your Subscription
Cancel, update credit card or change plan
);
}
export async function getServerSideProps(context) {
const session = await getSession(context);
if (!session) {
return { redirect: { permanent: false, destination: '/auth/login' } };
}
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,
}
});
return {
props: {user}, // will be passed to the page component as props
}
}