From 6ae1fbd0439a8e22392499a40634bd6afdf9196b Mon Sep 17 00:00:00 2001 From: Martyn Janes Date: Tue, 16 Mar 2021 09:08:32 +0100 Subject: [PATCH 1/5] fix: Cleanup the signup detail on login --- packages/shared/lib/app.ts | 21 +++++++++++++++++---- packages/shared/lib/router.ts | 7 +++---- packages/shared/routes/setup/Setup.svelte | 5 +++-- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/packages/shared/lib/app.ts b/packages/shared/lib/app.ts index dbaaa252f46..1983f89b25a 100644 --- a/packages/shared/lib/app.ts +++ b/packages/shared/lib/app.ts @@ -6,10 +6,6 @@ import { closePopup } from './popup' import { activeProfile, clearActiveProfile } from './profile' import { resetRouter } from './router' import { api, destroyActor, resetWallet } from './wallet' -/** - * Notification content - */ -export const notification = writable(null) /** * Mobile mode @@ -58,6 +54,23 @@ export const loggedIn = writable(false) */ export const developerMode = persistent('developerMode', false) +/** + * Cleanup the signup vars + */ + export const cleanupSignup = () => { + mnemonic.set(null) + strongholdPassword.set(null) + walletPin.set(null) +} + +/** + * Log in to the current profile + */ +export const login = () => { + cleanupSignup() + loggedIn.set(true) +} + /** * Logout from current profile */ diff --git a/packages/shared/lib/router.ts b/packages/shared/lib/router.ts index 1afa60b4482..817d0e57016 100644 --- a/packages/shared/lib/router.ts +++ b/packages/shared/lib/router.ts @@ -1,4 +1,4 @@ -import { loggedIn, notification, strongholdPassword, walletPin } from 'shared/lib/app' +import { loggedIn, login, strongholdPassword, walletPin } from 'shared/lib/app' import { profiles } from 'shared/lib/profile' import { AccountRoutes, AppRoute, SettingsRoutes, SetupType, Tabs, WalletRoutes } from 'shared/lib/typings/routes' import { get, readable, writable } from 'svelte/store' @@ -24,7 +24,6 @@ export const path = readable(null, (set) => { const updatePath = (): void => { const pathName = window.location.hash.substr(1) set(pathName) - notification.set(null) } window.addEventListener('hashchange', updatePath) @@ -96,7 +95,7 @@ export const routerNext = (event) => { if (shouldAddProfile) { nextRoute = AppRoute.Setup } else { - loggedIn.set(true) + login() nextRoute = AppRoute.Dashboard } break @@ -171,7 +170,7 @@ export const routerNext = (event) => { nextRoute = AppRoute.Congratulations break case AppRoute.Congratulations: - loggedIn.set(true) + login() nextRoute = AppRoute.Dashboard break } diff --git a/packages/shared/routes/setup/Setup.svelte b/packages/shared/routes/setup/Setup.svelte index e21989acdbd..b9f3d0189b6 100644 --- a/packages/shared/routes/setup/Setup.svelte +++ b/packages/shared/routes/setup/Setup.svelte @@ -1,11 +1,11 @@