xxxxxxxxxx
export async function getServerSideProps({ params }) {
try {
const user = await prisma.user.findUnique({
where: { id: params.id }
});
if (!user.dogs) {
return {
redirect: {
permanent: false,
destination: `/no-dogs`
},
};
}
return { props: { user } };
} catch (e) {
console.error('uh oh');
}
}