MCPcopy Index your code
hub / github.com/Linen-dev/linen.dev / getServerSideProps

Function getServerSideProps

apps/web/pages/getting-started/index.tsx:13–43  ·  view source on GitHub ↗
(context)

Source from the content-addressed store, hash-verified

11}
12
13export const getServerSideProps: GetServerSideProps = async (context) => {
14 const session = await Session.find(context.req, context.res);
15
16 if (!session) {
17 return {
18 redirect: {
19 permanent: false,
20 destination:
21 'signin?' + new URLSearchParams({ callbackUrl: '/getting-started' }),
22 },
23 };
24 }
25
26 const auth = await findAccountsFromAuth(session?.user?.email!);
27
28 const invites = await findInvitesByEmail(session?.user?.email!);
29
30 await trackPageView(context, session.user?.email || undefined);
31
32 return {
33 props: {
34 session,
35 accounts: auth?.users
36 .filter(filterAccounts)
37 .map((e) => serializeAccount(e.account)),
38 invites: invites
39 .filter(filterAccounts)
40 .map((e) => ({ inviteId: e.id, ...serializeAccount(e.accounts) })),
41 },
42 };
43};
44
45const filterAccounts = (e: any) =>
46 e.account?.discordDomain ||

Callers

nothing calls this directly

Calls 6

findAccountsFromAuthFunction · 0.90
findInvitesByEmailFunction · 0.90
trackPageViewFunction · 0.90
serializeAccountFunction · 0.90
mapMethod · 0.80
findMethod · 0.45

Tested by

no test coverage detected