mirror of
https://github.com/aljazceru/mutiny-web.git
synced 2025-12-17 06:14:21 +01:00
Move clear interval until after things are setup
This commit is contained in:
committed by
Tony Giorgio
parent
152abb0e10
commit
318fa6f353
@@ -163,6 +163,7 @@ export const makeMegaStoreContext = () => {
|
||||
}
|
||||
},
|
||||
async setup(password?: string): Promise<void> {
|
||||
let interval: NodeJS.Timeout | undefined;
|
||||
try {
|
||||
const settings = await getSettings();
|
||||
setState({ load_stage: "setup" });
|
||||
@@ -179,7 +180,7 @@ export const makeMegaStoreContext = () => {
|
||||
// 90 seconds to load or we bail
|
||||
const start = Date.now();
|
||||
const MAX_LOAD_TIME = 90000;
|
||||
const interval = setInterval(() => {
|
||||
interval = setInterval(() => {
|
||||
console.log("Running setup", Date.now() - start);
|
||||
if (Date.now() - start > MAX_LOAD_TIME) {
|
||||
clearInterval(interval);
|
||||
@@ -215,8 +216,6 @@ export const makeMegaStoreContext = () => {
|
||||
nsec
|
||||
);
|
||||
|
||||
clearInterval(interval);
|
||||
|
||||
if (!success) {
|
||||
throw new Error("Failed to initialize mutiny wallet");
|
||||
}
|
||||
@@ -265,8 +264,15 @@ export const makeMegaStoreContext = () => {
|
||||
|
||||
console.log("Wallet initialized");
|
||||
|
||||
clearInterval(interval);
|
||||
|
||||
await actions.postSetup();
|
||||
} catch (e) {
|
||||
// clear the interval if it exists
|
||||
if (interval) {
|
||||
clearInterval(interval);
|
||||
}
|
||||
|
||||
console.error(e);
|
||||
if (eify(e).message === "Incorrect password entered.") {
|
||||
setState({ needs_password: true });
|
||||
|
||||
Reference in New Issue
Block a user