Fix wish import state after cancel
parent
0d89132731
commit
8245467748
|
@ -94,7 +94,10 @@
|
||||||
let wishes = {};
|
let wishes = {};
|
||||||
|
|
||||||
async function startImport() {
|
async function startImport() {
|
||||||
|
cancelled = false;
|
||||||
error = '';
|
error = '';
|
||||||
|
fetchController = new AbortController();
|
||||||
|
fetchSignal = fetchController.signal;
|
||||||
|
|
||||||
if (selectedType === 'pclocal') {
|
if (selectedType === 'pclocal') {
|
||||||
await importFromGeneratedText();
|
await importFromGeneratedText();
|
||||||
|
@ -121,8 +124,8 @@
|
||||||
await checkUID();
|
await checkUID();
|
||||||
for (const [wishNumber, type] of Object.entries(types)) {
|
for (const [wishNumber, type] of Object.entries(types)) {
|
||||||
await getLog(wishNumber, type);
|
await getLog(wishNumber, type);
|
||||||
if (cancelled) return;
|
|
||||||
await sleep(2000);
|
await sleep(2000);
|
||||||
|
if (cancelled) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Object.keys(wishes).length === 0) {
|
if (Object.keys(wishes).length === 0) {
|
||||||
|
@ -514,7 +517,6 @@
|
||||||
if (cancelled) return;
|
if (cancelled) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
console.log('trying n=', i);
|
|
||||||
const res = await fetch(url, options);
|
const res = await fetch(url, options);
|
||||||
result = res;
|
result = res;
|
||||||
if (res.status !== 200) {
|
if (res.status !== 200) {
|
||||||
|
@ -524,7 +526,6 @@
|
||||||
return res;
|
return res;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
error = err;
|
error = err;
|
||||||
console.log('trying error n=', i);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -601,9 +602,6 @@
|
||||||
$: selectedServer, updateServer();
|
$: selectedServer, updateServer();
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
fetchController = new AbortController();
|
|
||||||
fetchSignal = fetchController.signal;
|
|
||||||
|
|
||||||
detectPlatform();
|
detectPlatform();
|
||||||
selectedServer = servers.find((e) => e.value === $server);
|
selectedServer = servers.find((e) => e.value === $server);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue