Enable Data Fetch logging with log=1 param (#2042)
parent
7384675b6b
commit
6687544e66
|
@ -123,7 +123,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
|
||||||
const ssr = await ssrInit(context);
|
const ssr = await ssrInit(context);
|
||||||
|
|
||||||
const username = (context.query.user as string).toLowerCase();
|
const username = (context.query.user as string).toLowerCase();
|
||||||
|
const dataFetchStart = Date.now();
|
||||||
const user = await prisma.user.findUnique({
|
const user = await prisma.user.findUnique({
|
||||||
where: {
|
where: {
|
||||||
username: username.toLowerCase(),
|
username: username.toLowerCase(),
|
||||||
|
@ -205,7 +205,10 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
|
||||||
},
|
},
|
||||||
take: user.plan === "FREE" ? 1 : undefined,
|
take: user.plan === "FREE" ? 1 : undefined,
|
||||||
});
|
});
|
||||||
|
const dataFetchEnd = Date.now();
|
||||||
|
if (context.query.log === "1") {
|
||||||
|
context.res.setHeader("X-Data-Fetch-Time", `${dataFetchEnd - dataFetchStart}ms`);
|
||||||
|
}
|
||||||
const eventTypesRaw = eventTypesWithHidden.filter((evt) => !evt.hidden);
|
const eventTypesRaw = eventTypesWithHidden.filter((evt) => !evt.hidden);
|
||||||
|
|
||||||
const eventTypes = eventTypesRaw.map((eventType) => ({
|
const eventTypes = eventTypesRaw.map((eventType) => ({
|
||||||
|
|
Loading…
Reference in New Issue