Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development edit email #2725

Merged
merged 6 commits into from
May 23, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions packages/playground/src/dashboard/twin_view.vue
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ import { useGrid, useProfileManager } from "../stores";
import type { FarmInterface } from "../types";
import { createCustomToast, ToastType } from "../utils/custom_toast";
import { getFarms } from "../utils/get_farms";
import { getGrid, storeEmail } from "../utils/grid";

import type { Balance } from "../utils/grid";
import { loadBalance, storeEmail } from "../utils/grid";
samaradel marked this conversation as resolved.
Show resolved Hide resolved
const profileManager = useProfileManager();

const editingTwin = ref(false);
Expand Down Expand Up @@ -264,13 +264,22 @@ function redirectToDao() {

async function saveEmail() {
try {
loading.value = true;
savingEmail.value = true;
profileManager.updateEmail(email.value);
await storeEmail(grid!, email.value);
editEmail.value = false;
loading.value = false;
savingEmail.value = false;
const balance: Balance = await loadBalance(grid!);
if (balance.free < 1) {
editEmail.value = false;
createCustomToast(
"Invalid Transaction: Inability to pay some fees, e.g. account balance too low",
samaradel marked this conversation as resolved.
Show resolved Hide resolved
ToastType.danger,
);
} else {
samaradel marked this conversation as resolved.
Show resolved Hide resolved
loading.value = true;
savingEmail.value = true;
profileManager.updateEmail(email.value);
await storeEmail(grid!, email.value);
editEmail.value = false;
loading.value = false;
savingEmail.value = false;
}
} catch (e) {
console.log(e);
}
Expand Down
Loading