Make sure data is migrated before leaving registration page

pull/1/head
yflory 8 years ago
parent 39ca2e6dd6
commit a5c03c1540

@ -227,13 +227,26 @@ define([
proxy[k] = map[k];
});
delete localStorage.FS_hash;
if (!proxy[USERNAME_KEY]) {
proxy[USERNAME_KEY] = opt.name;
}
next();
var whenSynced = function () {
delete localStorage.FS_hash;
if (!proxy[USERNAME_KEY]) {
proxy[USERNAME_KEY] = opt.name;
}
next();
};
// Make sure the migration is synced in chainpad before continuing otherwise
// we may leave that page too early or trigger a reload in another tab before
// the migration is complete
var check = function () {
if (APP.realtime.getUserDoc() === APP.realtime.getAuthDoc()) {
whenSynced();
return;
}
window.setTimeout(check, 300);
};
check();
});
});
});

Loading…
Cancel
Save