Skip to content

Commit

Permalink
Merge pull request #1638 from newjersey/feature-add-login-redirect-logic
Browse files Browse the repository at this point in the history
Feature add login redirect logic
  • Loading branch information
dsueltenfuss authored Feb 8, 2022
2 parents 79f1882 + f009fa7 commit cb97890
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion web/src/pages/roadmap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ const RoadmapPage = (props: Props): ReactElement => {

useEffect(() => {
if (!router.isReady) return;
if (router.query.error === "true" && userData?.profileData.hasExistingBusiness) {
if (
(router.query.error === "true" || (router.query?.code && router.query?.state)) &&
userData?.profileData.hasExistingBusiness
) {
router.replace("/dashboard");
}

Expand Down
4 changes: 2 additions & 2 deletions web/test/pages/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ describe("HomePage", () => {
expect(mockPush).toHaveBeenCalledWith("/onboarding");
});

it("redirects to onboarding page when it is unknown if user has completed onboarding flow or not", () => {
it("redirects to roadmap page when it is unknown if user has completed onboarding flow or not", () => {
setMockUserDataResponse({ error: "NO_DATA", userData: undefined });
render(withAuth(<Home />, { user: generateUser({}) }));
expect(mockPush).toHaveBeenCalledWith("/roadmap");
expect(mockPush).toHaveBeenCalledWith("/roadmap?error=true");
});
it("opens the modal with signUp = true in the querystring", () => {
useMockRouter({ isReady: true, query: { signUp: "true" } });
Expand Down

0 comments on commit cb97890

Please sign in to comment.