Skip to content

Commit

Permalink
fix: fix sygotchi object being null
Browse files Browse the repository at this point in the history
  • Loading branch information
JanSteppacher committed Aug 2, 2023
1 parent f65f00b commit 57bdd18
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions src/app/show-sygotchi/show-sygotchi.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,20 @@ export class ShowSygotchiComponent implements OnInit {

this.canvas = paper.project.activeLayer;

this.actionsService.getSygotchi().subscribe(result => {
this.canvas = paper.project.activeLayer;
this.store.select(selectSygotchi).subscribe(result => {
this.sygotchi = result
this.store.select(selectSygotchi).subscribe(result => {
this.sygotchi = result

if (this.sygotchi === null) {
this.actionsService.getSygotchi().subscribe(result => {
this.sygotchi = result
this.store.dispatch(setSygotchi({ sygotchi: result as SyGotchi }))
this.buildSygotchi()
})
} else {
this.wsService.initializeWebSocketConnection(this.sygotchi.id)
if(this.sygotchi === null) {
this.actionsService.getSygotchi().subscribe(result => {
this.sygotchi = result
this.store.dispatch(setSygotchi({sygotchi: result as SyGotchi}))
this.buildSygotchi()
}
})
})
} else {
this.wsService.initializeWebSocketConnection(this.sygotchi.id)
this.buildSygotchi()
}
})
}

Expand Down

0 comments on commit 57bdd18

Please sign in to comment.