get images from API

This commit is contained in:
Jörn-Michael Miehe 2022-09-16 14:50:45 +00:00
parent 189da9bcf3
commit e0ba5c0566

View file

@ -42,6 +42,7 @@
<script lang="ts">
import { Component, Vue } from "vue-property-decorator";
import { CalendarData } from "./components/calendar/CalendarModel";
import TitleBar from "./components/title/TitleBar.vue";
import Dashboard from "./components/Dashboard.vue";
@ -70,13 +71,13 @@ export default class App extends Vue {
private logo_below = "OV Musterstadt";
private title_html = "<h1>changeme</h1>";
private image_urls = require("@/assets/image_testdata.json");
private image_urls: string[] = require("@/assets/image_testdata.json");
private image_height = 300;
private image_contain = false;
private image_speed = 10000;
private message_html = require("@/assets/lipsum.json");
private calendar_data = require("@/assets/calendar_testdata.json");
private calendar_data: CalendarData[] = require("@/assets/calendar_testdata.json");
private calendar_speed = 10000;
private server_host = "https://oekzident.de";
private server_name = "OEKZident";
@ -124,6 +125,18 @@ export default class App extends Vue {
});
}
private api_query_simple_list(
endpoint: string,
on_success: (data: string[]) => void
): void {
this.api_query_simple(endpoint, (data) => {
if (!Array.isArray(data)) return;
if (!data.every((value) => typeof value === "string")) return;
on_success(data);
});
}
private update(): void {
// Update Logo Config
this.api_query_simple_object("misc/config/logo", (data) => {
@ -137,6 +150,11 @@ export default class App extends Vue {
});
// Update Images
this.api_query_simple_list("image/list", (data) => {
this.image_urls = data.map((name: string) =>
this.$ovdashboard.api_url("image/get/" + name)
);
});
// Update Image Config
this.api_query_simple_object("image/config", (data) => {
@ -150,7 +168,7 @@ export default class App extends Vue {
this.message_html = data;
});
// Update Calendars
// Update Calendar Aggregates
// Update Calendar Config
this.api_query_simple_object("calendar/config", (data) => {