Update assets/js/offline-engine.js
This commit is contained in:
@@ -192,4 +192,23 @@ export async function resetSessionStats() {
|
||||
correct: 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