Compare commits
2 Commits
5f256e1983
...
8d6129590a
Author | SHA1 | Date | |
---|---|---|---|
8d6129590a | |||
13aa2c29b0 |
|
@ -61,9 +61,9 @@
|
|||
<p id="foxes-warn" *ngIf="!checkTotalFoxPoints()">Please check the number of caught foxes!</p>
|
||||
<button (click)="switchToNextPage()" [disabled]="!checkAllExtraPoints()">Next</button>
|
||||
</div>
|
||||
<div id="summary" class="visible-{{this.currentPage === 5}}">
|
||||
<div id="summary" class="visible-{{this.currentPage === 6}}">
|
||||
<p>Game Summary</p>
|
||||
<button>Save Game</button>
|
||||
<button (click)="saveGame()">Save Game</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="scores">
|
||||
|
|
|
@ -702,4 +702,22 @@ export class AddGameComponent implements OnInit {
|
|||
checkAllExtraPoints(): boolean {
|
||||
return this.checkTotalFoxPoints();
|
||||
}
|
||||
|
||||
/**
|
||||
* _____
|
||||
* / ___/__ ______ ___ ____ ___ ____ ________ __
|
||||
* \__ \/ / / / __ `__ \/ __ `__ \/ __ `/ ___/ / / /
|
||||
* ___/ / /_/ / / / / / / / / / / / /_/ / / / /_/ /
|
||||
* /____/\__,_/_/ /_/ /_/_/ /_/ /_/\__,_/_/ \__, /
|
||||
* /____/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Sends the game stats to the API to be saved
|
||||
*/
|
||||
saveGame(): void {
|
||||
//TODO implement
|
||||
// call api method, then return to gameNight page / close modal or sth like that
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,8 +17,20 @@ export class HomeComponent implements OnInit {
|
|||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
// TODO: First try to read existing session data
|
||||
this.authenticateUser();
|
||||
if(!HomeComponent.sessionDataAvailable()) {
|
||||
this.authenticateUser();
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if there is session data saved in the local storage
|
||||
* @return If there is session data available
|
||||
*/
|
||||
private static sessionDataAvailable(): boolean {
|
||||
let user = StorageService.getUserInfo();
|
||||
|
||||
return user !== undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -35,6 +47,10 @@ export class HomeComponent implements OnInit {
|
|||
sessionKey: ''
|
||||
};
|
||||
|
||||
if(user.firebonkId === undefined || user.firstName === undefined || user.token === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
let authenticatedUser = ApiService.performAuthentication(user);
|
||||
StorageService.setUserInfo(authenticatedUser);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user