Skip to content

Commit

Permalink
login to new ui
Browse files Browse the repository at this point in the history
  • Loading branch information
17Amir17 committed Sep 25, 2024
1 parent 62e49a8 commit 8d0fb3d
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions apps/passport-client/src/dispatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export type Action =
autoRegister: boolean;
/** Zupass will attempt to automatically direct a user to targetFolder on registration */
targetFolder: string | undefined | null;
newUi?: boolean;
}
| {
type: "login";
Expand Down Expand Up @@ -224,7 +225,8 @@ export async function dispatch(
action.targetFolder,
action.autoRegister,
state,
update
update,
action.newUi
);
case "login":
return createNewUserWithPassword(
Expand Down Expand Up @@ -456,7 +458,8 @@ async function createNewUserSkipPassword(
targetFolder: string | undefined | null,
autoRegister: boolean,
state: AppState,
update: ZuUpdate
update: ZuUpdate,
newUi = false
): Promise<void> {
update({
modal: { modalType: "none" }
Expand Down Expand Up @@ -498,7 +501,8 @@ async function createNewUserSkipPassword(
newUserResult.value,
state,
update,
targetFolder
targetFolder,
newUi
);
}

Expand Down Expand Up @@ -560,7 +564,8 @@ async function finishAccountCreation(
user: User,
state: AppState,
update: ZuUpdate,
targetFolder?: string | null
targetFolder?: string | null,
newUi = false
): Promise<void> {
// Verify that the identity is correct.
if (
Expand Down Expand Up @@ -632,12 +637,14 @@ async function finishAccountCreation(
// Account creation is complete. Close any existing modal, and redirect
// user if they were in the middle of something.
update({ modal: { modalType: "none" } });

const baseRoute = newUi ? "#/new/" : "#/";
if (hasPendingRequest()) {
window.location.hash = "#/login-interstitial";
window.location.hash = `${baseRoute}login-interstitial`;
} else {
window.location.hash = targetFolder
? `#/?folder=${encodeURIComponent(targetFolder)}`
: "#/";
? `${baseRoute}?folder=${encodeURIComponent(targetFolder)}`
: baseRoute;
}
}

Expand Down

0 comments on commit 8d0fb3d

Please sign in to comment.