use API route user/title in UI
This commit is contained in:
parent
b8c30d130a
commit
d0bdc62433
2 changed files with 15 additions and 7 deletions
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<section class="hero is-small is-primary" style="overflow-x: auto">
|
<section class="hero is-small is-primary" style="overflow-x: auto">
|
||||||
<div class="hero-body">
|
<div class="hero-body">
|
||||||
<h1 class="title is-uppercase">Adventskalender</h1>
|
<h1 class="title is-uppercase">{{ title }}</h1>
|
||||||
<h2 class="subtitle">Der Gelöt</h2>
|
<h2 class="subtitle">Der Gelöt</h2>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
@ -46,12 +46,18 @@ import UserView from "./components/UserView.vue";
|
||||||
})
|
})
|
||||||
export default class extends Vue {
|
export default class extends Vue {
|
||||||
public is_admin = false;
|
public is_admin = false;
|
||||||
|
public title = "Adventskalender";
|
||||||
public footer = "";
|
public footer = "";
|
||||||
|
|
||||||
public mounted(): void {
|
public mounted(): void {
|
||||||
this.$advent22
|
Promise.all([
|
||||||
.api_get<string>("user/footer")
|
this.$advent22.api_get<string>("user/title"),
|
||||||
.then((footer) => (this.footer = footer))
|
this.$advent22.api_get<string>("user/footer"),
|
||||||
|
])
|
||||||
|
.then(([title, footer]) => {
|
||||||
|
this.title = title;
|
||||||
|
this.footer = footer;
|
||||||
|
})
|
||||||
.catch((error) => alert(this.$advent22.format_user_error(error)));
|
.catch((error) => alert(this.$advent22.format_user_error(error)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,8 +38,7 @@
|
||||||
<h3>Rätsel</h3>
|
<h3>Rätsel</h3>
|
||||||
<dl>
|
<dl>
|
||||||
<dt>Titel</dt>
|
<dt>Titel</dt>
|
||||||
<!-- TODO -->
|
<dd>{{ title }}</dd>
|
||||||
<dd>Advent22</dd>
|
|
||||||
|
|
||||||
<dt>Offene Türchen</dt>
|
<dt>Offene Türchen</dt>
|
||||||
<dd>{{ num_user_doors }}</dd>
|
<dd>{{ num_user_doors }}</dd>
|
||||||
|
@ -215,6 +214,7 @@ export default class extends Vue {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
public doors: DoorsSaved = [];
|
public doors: DoorsSaved = [];
|
||||||
|
public title = "";
|
||||||
public footer = "";
|
public footer = "";
|
||||||
public num_user_doors = 0;
|
public num_user_doors = 0;
|
||||||
public next_door: number | null = null;
|
public next_door: number | null = null;
|
||||||
|
@ -233,13 +233,15 @@ export default class extends Vue {
|
||||||
this.$advent22.api_get<ConfigModel>("admin/config_model"),
|
this.$advent22.api_get<ConfigModel>("admin/config_model"),
|
||||||
this.$advent22.api_get<DoorsSaved>("admin/doors"),
|
this.$advent22.api_get<DoorsSaved>("admin/doors"),
|
||||||
this.$advent22.api_get<DoorsSaved>("user/doors"),
|
this.$advent22.api_get<DoorsSaved>("user/doors"),
|
||||||
|
this.$advent22.api_get<string>("user/title"),
|
||||||
this.$advent22.api_get<string>("user/footer"),
|
this.$advent22.api_get<string>("user/footer"),
|
||||||
this.$advent22.api_get<number | null>("user/next_door"),
|
this.$advent22.api_get<number | null>("user/next_door"),
|
||||||
])
|
])
|
||||||
.then(([config_model, doors, user_doors, footer, next_door]) => {
|
.then(([config_model, doors, user_doors, title, footer, next_door]) => {
|
||||||
this.config_model = config_model;
|
this.config_model = config_model;
|
||||||
this.doors = doors;
|
this.doors = doors;
|
||||||
this.num_user_doors = user_doors.length;
|
this.num_user_doors = user_doors.length;
|
||||||
|
this.title = title;
|
||||||
this.footer = footer;
|
this.footer = footer;
|
||||||
this.next_door = next_door;
|
this.next_door = next_door;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue