Chika 8d1d3fed7c Components: create Calculation Component
add Calculation Component to Home page
2022-06-01 20:49:46 +03:00

33 lines
732 B
TypeScript

import initializeApollo from 'apollo/client';
import Calculation from 'Components/Calculation';
import type { GetServerSideProps } from 'next';
import { fetchUser } from 'services/user';
import type { BasePageProps } from 'types/page';
type PageProps = BasePageProps;
function Home() {
return <Calculation />;
}
export const getServerSideProps: GetServerSideProps<PageProps> = async (ctx) => {
const user = await fetchUser({
headers: ctx?.req?.headers?.cookie
? {
cookie: ctx.req.headers.cookie,
}
: undefined,
});
const apolloClient = initializeApollo();
return {
props: {
user,
initialApolloState: apolloClient.cache.extract(),
},
};
};
export default Home;