Update assets/js/offline-engine.js
This commit is contained in:
@@ -193,3 +193,22 @@ export async function resetSessionStats() {
|
|||||||
wrong: 0
|
wrong: 0
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
import { saveWords } from './offline-engine.js';
|
||||||
|
|
||||||
|
export async function importList(lang, list) {
|
||||||
|
|
||||||
|
const res = await fetch(
|
||||||
|
`/api/list.php?lang=${lang}&list=${list}`
|
||||||
|
);
|
||||||
|
|
||||||
|
const data = await res.json();
|
||||||
|
|
||||||
|
if (!data.words) {
|
||||||
|
throw new Error('No words');
|
||||||
|
}
|
||||||
|
|
||||||
|
await saveWords(lang, list, data.words);
|
||||||
|
|
||||||
|
return data.words.length;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user