(context)
| 11 | } |
| 12 | |
| 13 | export 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 | |
| 45 | const filterAccounts = (e: any) => |
| 46 | e.account?.discordDomain || |
nothing calls this directly
no test coverage detected