Skip to content

Commit

Permalink
feat: create a route to handle invite keys that includes the customer…
Browse files Browse the repository at this point in the history
… slug

The existing universal link route does not contain the enterprise slug, so for unauthenticated users,
the frontend has no knowledge of which customer’s branded logistration for which to redirect.
This is typically relied upon based on the `:enterpriseSlug` route parameter in the URL,
which is missing for the existing universal link route.
This change adds a new invite key route that includes the enterprise slug (but
not under the root loader). This will enable us to produce slug-aware invite
URLs from the admin portal, that receiving learners
can use to become linked to the enterprise via the B2B-specific auth flow (which is customer-aware).
ENT-9428
  • Loading branch information
iloveagent57 committed Sep 27, 2024
1 parent 5f5a7c5 commit b29181f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
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
13 changes: 13 additions & 0 deletions src/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,19 @@ function getOtherRoutes() {
};
},
},
{
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

0 comments on commit b29181f

Please sign in to comment.