updates frontend to use DB api

This commit is contained in:
2019-07-04 14:53:50 +02:00
parent 4e28eb4159
commit 503ebf7b6b
5 changed files with 103 additions and 61 deletions

View File

@@ -1,9 +1,9 @@
<template>
<main id="app" class="section">
<section id="content" class="columns is-desktop">
<Player v-if="fullyLoaded"></Player>
<Player v-if="state.initiated"></Player>
<div class="column">
<Chest :player="0" v-if="fullyLoaded"></Chest>
<Chest :player="0" v-if="state.initiated"></Chest>
</div>
</section>
</main>
@@ -32,14 +32,18 @@ function getCookie(cname) {
export default {
name: 'app',
data () { return {
fullyLoaded: false,
};},
data () {
return {
state: AppStorage.state,
};
},
components: {
Player,
Chest
},
created () {
// Initiate with active player set to value found in cookie
// or as group by default.
const cookie = getCookie("player_id");
let playerId;
if (cookie == "") {
@@ -47,8 +51,7 @@ export default {
} else {
playerId = Number(cookie);
}
AppStorage.initStorage(playerId)
.then(_ => this.fullyLoaded = true);
AppStorage.initStorage(playerId);
},
}
</script>