fix
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user