This commit is contained in:
2026-10-19 01:06:27 +07:00
parent 7fa0004ab9
commit 4ef830a3b5
3 changed files with 104 additions and 0 deletions
+12
View File
@@ -1668,8 +1668,20 @@ export class Online {
await this.refreshMaterials()
await this.poll()
}
async restoreGames() {
if (!this.credentials) return
const generation = this.generation
try {
await this.loadGames()
} catch (error) {
if (generation === this.generation && !this.state.error)
this.state.error = error instanceof Error ? error.message : 'Не удалось загрузить список игр'
}
}
private async loadGames() {
const generation = this.generation
const result = await this.client().GetGames({})
if (generation !== this.generation) throw new SessionChangedError()
if (!Array.isArray(result.games ?? [])) throw new Error('Некорректный список игр')
this.state.games = ((result.games ?? []) as unknown[]).map((value) => {
const g = object(value)