Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: create a route to handle invite keys that includes the customer slug #1200

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/components/app/routes/createAppRouter.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,14 @@ describe('createAppRouter', () => {
usesQueryClient: false,
}],
},
{
currentRoutePath: '/test-enterprise/invite/enterprise-customer-invite-key',
expectedRouteTestId: 'invite',
expectedRouteLoaders: [{
loader: makeEnterpriseInviteLoader,
usesQueryClient: false,
}],
},
{
currentRoutePath: '/test-enterprise',
expectedRouteTestId: 'dashboard',
Expand Down
22 changes: 22 additions & 0 deletions src/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,28 @@ function getOtherRoutes() {
};
},
},
{
/**
* We want to support a slug-"aware" version of the invite key route,
* but we don't want it nested under the root loader via
* enterpriseSlugRoutes above. Putting this route under the root loader
* would mean that the post-registration redirect back to this route
* would run through the root loader logic with a now-authenticated-but-unlinked
* requesting user, which will throw a 404 (until the async call to
* `link-user/` resolves and the page is reloaded).
*/
path: ':enterpriseSlug/invite/:enterpriseCustomerInviteKey',
lazy: async () => {
const {
default: EnterpriseInviteRoute,
makeEnterpriseInviteLoader,
} = await import('./components/app/routes/EnterpriseInviteRoute');
return {
Component: EnterpriseInviteRoute,
loader: makeEnterpriseInviteLoader(),
};
},
},
];
return otherRoutes;
}
Expand Down
Loading