({ query, res })
| 200 | organization: Omit<Organization, 'members'>; |
| 201 | user: Author; |
| 202 | }> = async ({ query, res }) => { |
| 203 | const token = getFirstQueryParam(query.token); |
| 204 | const orgId = getFirstQueryParam(query.orgId); |
| 205 | |
| 206 | if (!token || !orgId) { |
| 207 | return { |
| 208 | redirect: { |
| 209 | destination: '/', |
| 210 | permanent: false, |
| 211 | }, |
| 212 | }; |
| 213 | } |
| 214 | |
| 215 | try { |
| 216 | const { getOrganizationByIdAndInviteToken } = await gqlClient.request<{ |
| 217 | getOrganizationByIdAndInviteToken: { |
| 218 | user: Author; |
| 219 | organization: Omit<Organization, 'members'>; |
| 220 | }; |
| 221 | }>(GET_ORGANIZATION_BY_ID_AND_INVITE_TOKEN_QUERY, { |
| 222 | id: orgId, |
| 223 | token, |
| 224 | }); |
| 225 | |
| 226 | res.setHeader( |
| 227 | 'Cache-Control', |
| 228 | `public, max-age=0, must-revalidate, s-maxage=${24 * 60 * 60}`, |
| 229 | ); |
| 230 | |
| 231 | return { |
| 232 | props: { |
| 233 | token, |
| 234 | user: getOrganizationByIdAndInviteToken?.user, |
| 235 | organization: getOrganizationByIdAndInviteToken?.organization, |
| 236 | }, |
| 237 | }; |
| 238 | } catch { |
| 239 | return { |
| 240 | notFound: true, |
| 241 | }; |
| 242 | } |
| 243 | }; |
| 244 | |
| 245 | // Personal, token-bearing invite link: never index it. |
| 246 | Page.layoutProps = { seo: { ...noindexSeoProps } }; |
nothing calls this directly
no test coverage detected