use wrappers
This commit is contained in:
parent
5ffc886298
commit
7df24feb00
1 changed files with 34 additions and 61 deletions
|
@ -111,101 +111,74 @@ export default class App extends Vue {
|
||||||
|
|
||||||
private api_query_simple_object(
|
private api_query_simple_object(
|
||||||
endpoint: string,
|
endpoint: string,
|
||||||
on_success: (data: Record<string, string>) => void
|
on_success: (data: Record<string, unknown>) => void
|
||||||
): void {
|
): void {
|
||||||
this.api_query_simple(endpoint, (data) => {
|
this.api_query_simple(endpoint, (data) => {
|
||||||
if (typeof data !== "object") return;
|
if (typeof data !== "object") return;
|
||||||
if (data === null) return;
|
if (data === null) return;
|
||||||
|
|
||||||
on_success(data as Record<string, string>);
|
on_success(data as Record<string, unknown>);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private update(): void {
|
private update(): void {
|
||||||
// Update Logo Config
|
// Update Logo Config
|
||||||
this.api_query_simple_object("misc/config/logo", (data) => {
|
this.api_query_simple_object("misc/config/logo", (data) => {
|
||||||
this.logo_above = data.above;
|
this.logo_above = data.above as string;
|
||||||
this.logo_below = data.below;
|
this.logo_below = data.below as string;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Update Title
|
// Update Title
|
||||||
this.$axios
|
this.api_query_simple_string("text/get/html/title", (data) => {
|
||||||
.get(this.$ovdashboard.api_url("text/get/html/title"))
|
this.title_html = data;
|
||||||
.then((response) => {
|
});
|
||||||
this.title_html = response.data;
|
|
||||||
})
|
|
||||||
.catch(this.fail("Title"));
|
|
||||||
|
|
||||||
// Update Images
|
// Update Images
|
||||||
|
|
||||||
// Update Image Config
|
// Update Image Config
|
||||||
this.$axios
|
this.api_query_simple_object("image/config", (data) => {
|
||||||
.get(this.$ovdashboard.api_url("image/config"))
|
this.image_height = data.height as number;
|
||||||
.then((response) => {
|
this.image_contain = data.contain as boolean;
|
||||||
this.image_height = response.data.height;
|
this.image_speed = data.speed as number;
|
||||||
this.image_contain = response.data.contain;
|
});
|
||||||
this.image_speed = response.data.speed;
|
|
||||||
})
|
|
||||||
.catch(this.fail("Image Config"));
|
|
||||||
|
|
||||||
// Update Message
|
// Update Message
|
||||||
this.$axios
|
this.api_query_simple_string("text/get/html/message", (data) => {
|
||||||
.get(this.$ovdashboard.api_url("text/get/html/message"))
|
this.message_html = data;
|
||||||
.then((response) => {
|
});
|
||||||
this.message_html = response.data;
|
|
||||||
})
|
|
||||||
.catch(this.fail("Message"));
|
|
||||||
|
|
||||||
// Update Calendars
|
// Update Calendars
|
||||||
|
|
||||||
// Update Calendar Config
|
// Update Calendar Config
|
||||||
this.$axios
|
this.api_query_simple_object("calendar/config", (data) => {
|
||||||
.get(this.$ovdashboard.api_url("calendar/config"))
|
this.calendar_speed = data.speed as number;
|
||||||
.then((response) => {
|
});
|
||||||
this.calendar_speed = response.data.speed;
|
|
||||||
})
|
|
||||||
.catch(this.fail("Calendar Config"));
|
|
||||||
|
|
||||||
// Update Server Config
|
// Update Server Config
|
||||||
this.$axios
|
this.api_query_simple_object("misc/config/server", (data) => {
|
||||||
.get(this.$ovdashboard.api_url("misc/config/server"))
|
this.server_host = data.host as string;
|
||||||
.then((response) => {
|
this.server_name = data.name as string;
|
||||||
this.server_host = response.data.host;
|
});
|
||||||
this.server_name = response.data.name;
|
|
||||||
})
|
|
||||||
.catch(this.fail("Server Config"));
|
|
||||||
|
|
||||||
// Update Version
|
// Update Version
|
||||||
this.$axios
|
this.api_query_simple_string("misc/version", (data) => {
|
||||||
.get(this.$ovdashboard.api_url("misc/version"))
|
this.dashboard_version = data;
|
||||||
.then((response) => {
|
});
|
||||||
this.dashboard_version = response.data;
|
|
||||||
})
|
|
||||||
.catch(this.fail("Version"));
|
|
||||||
|
|
||||||
// Update IP
|
// Update IP
|
||||||
this.$axios
|
this.api_query_simple_string("misc/lanip", (data) => {
|
||||||
.get(this.$ovdashboard.api_url("misc/lanip"))
|
this.dashboard_ip = data;
|
||||||
.then((response) => {
|
});
|
||||||
this.dashboard_ip = response.data;
|
|
||||||
})
|
|
||||||
.catch(this.fail("IP"));
|
|
||||||
|
|
||||||
// Update Ticker
|
// Update Ticker
|
||||||
this.$axios
|
this.api_query_simple_string("ticker/html", (data) => {
|
||||||
.get(this.$ovdashboard.api_url("ticker/html"))
|
this.ticker_html = data;
|
||||||
.then((response) => {
|
});
|
||||||
this.ticker_html = response.data;
|
|
||||||
})
|
|
||||||
.catch(this.fail("Ticker"));
|
|
||||||
|
|
||||||
// Update Ticker Config
|
// Update Ticker Config
|
||||||
this.$axios
|
this.api_query_simple_object("ticker/config", (data) => {
|
||||||
.get(this.$ovdashboard.api_url("ticker/config"))
|
this.ticker_color = data.color as string;
|
||||||
.then((response) => {
|
});
|
||||||
this.ticker_color = response.data.color;
|
|
||||||
})
|
|
||||||
.catch(this.fail("Ticker"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public mounted(): void {
|
public mounted(): void {
|
||||||
|
|
Loading…
Reference in a new issue