From 185e145afb0a76bf7aaafa74f18adcf639293cfb Mon Sep 17 00:00:00 2001 From: samaradel Date: Sun, 21 Apr 2024 12:17:45 +0200 Subject: [PATCH 1/2] Fix email instance --- packages/playground/src/dashboard/twin_view.vue | 5 ++--- packages/playground/src/weblets/profile_manager.vue | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/playground/src/dashboard/twin_view.vue b/packages/playground/src/dashboard/twin_view.vue index eea433627e..916e4502d7 100644 --- a/packages/playground/src/dashboard/twin_view.vue +++ b/packages/playground/src/dashboard/twin_view.vue @@ -62,7 +62,7 @@
- {{ email }} + {{ profileManager.profile?.email }} mdi-pencil
@@ -189,7 +189,7 @@ import { useProfileManager } from "../stores"; import type { FarmInterface } from "../types"; import { createCustomToast, ToastType } from "../utils/custom_toast"; import { getFarms } from "../utils/get_farms"; -import { getGrid, readEmail, storeEmail } from "../utils/grid"; +import { getGrid, storeEmail } from "../utils/grid"; const profileManager = useProfileManager(); @@ -222,7 +222,6 @@ const apps = [ onMounted(async () => { const profile = profileManager.profile!; const grid = await getGrid(profile); - email.value = await readEmail(grid!); if (!grid) { createCustomToast("Fetch Grid Failed", ToastType.danger); diff --git a/packages/playground/src/weblets/profile_manager.vue b/packages/playground/src/weblets/profile_manager.vue index 8c0c3765d9..b6da96c27f 100644 --- a/packages/playground/src/weblets/profile_manager.vue +++ b/packages/playground/src/weblets/profile_manager.vue @@ -807,6 +807,7 @@ async function storeAndLogin() { try { const grid = await getGrid({ mnemonic: mnemonic.value, keypairType: keypairType.value }); storeEmail(grid!, email.value); + profileManager.updateEmail(email.value); setCredentials(md5(password.value), mnemonicHash, keypairTypeHash, md5(email.value)); activate(mnemonic.value, keypairType.value); } catch (e) { From fda39d3a080e8aed901a0fff7d8ec192b14fbf9a Mon Sep 17 00:00:00 2001 From: samaradel Date: Sun, 21 Apr 2024 12:57:53 +0200 Subject: [PATCH 2/2] fix email update --- packages/playground/src/dashboard/twin_view.vue | 1 + packages/playground/src/weblets/profile_manager.vue | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/playground/src/dashboard/twin_view.vue b/packages/playground/src/dashboard/twin_view.vue index 916e4502d7..08d65d0b9b 100644 --- a/packages/playground/src/dashboard/twin_view.vue +++ b/packages/playground/src/dashboard/twin_view.vue @@ -222,6 +222,7 @@ const apps = [ onMounted(async () => { const profile = profileManager.profile!; const grid = await getGrid(profile); + if (!grid) { createCustomToast("Fetch Grid Failed", ToastType.danger); diff --git a/packages/playground/src/weblets/profile_manager.vue b/packages/playground/src/weblets/profile_manager.vue index b6da96c27f..89a2465202 100644 --- a/packages/playground/src/weblets/profile_manager.vue +++ b/packages/playground/src/weblets/profile_manager.vue @@ -701,7 +701,9 @@ async function activate(mnemonic: string, keypairType: KeypairType) { try { const grid = await getGrid({ mnemonic, keypairType }); const profile = await loadProfile(grid!); - + if (email.value) { + profile.email = email.value; + } profileManager.set({ ...profile, mnemonic }); emit("update:modelValue", false); } catch (e) { @@ -807,7 +809,6 @@ async function storeAndLogin() { try { const grid = await getGrid({ mnemonic: mnemonic.value, keypairType: keypairType.value }); storeEmail(grid!, email.value); - profileManager.updateEmail(email.value); setCredentials(md5(password.value), mnemonicHash, keypairTypeHash, md5(email.value)); activate(mnemonic.value, keypairType.value); } catch (e) {