api get str

This commit is contained in:
penner 2022-12-08 23:21:52 +00:00
parent e6f1f77ec3
commit 2b05e468e6
2 changed files with 22 additions and 1 deletions

View file

@ -1,7 +1,9 @@
<template>
<div class="container">
<div class="section">
<h1 class="title has-text-centered is-uppercase">Adventskalender</h1>
<h1 class="title has-text-centered is-uppercase">
Adventskalender {{ date }}
</h1>
<h2 class="subtitle has-text-centered">Der Gelöt</h2>
<ImageModal v-model="modal_visible" :imageUrl="image_url" />
@ -29,6 +31,13 @@ import ImageModal from "./components/ImageModal.vue";
export default class App extends Vue {
image_url = "";
modal_visible = false;
date = "";
public mounted(): void {
this.$advent22.api_get_string("days/date", (date: string) => {
this.date = date;
});
}
private paula(url: string): void {
this.image_url = url;

View file

@ -74,6 +74,18 @@ export class Advent22 {
"blob",
);
}
public api_get_string(
endpoint: string,
on_success: (data: string) => void,
): void {
this.api_get<string>(
endpoint,
(data: string) => {
on_success(data);
}
);
}
}
export const Advent22Plugin: Plugin = {