3 <div class="card" :class="item.class">
4 <a :href="item.url" :target="item.target" rel="noreferrer">
5 <div class="card-content">
7 <div v-if="item.logo" class="media-left">
8 <figure class="image is-48x48">
9 <img :src="item.logo" :alt="`${item.name} logo`" />
12 <div v-if="item.icon" class="media-left">
13 <figure class="image is-48x48">
14 <i style="font-size: 35px" :class="['fa-fw', item.icon]"></i>
17 <div class="media-content">
18 <p class="title is-4">{{ item.name }}</p>
19 <p class="subtitle is-6">
20 <template v-if="item.subtitle">
23 <template v-else-if="meal">
24 Today: {{ meal.name }}
26 <template v-else-if="stats">
27 happily keeping {{ stats.totalRecipes }} recipes organized
32 <div class="tag" :class="item.tagstyle" v-if="item.tag">
33 <strong class="tag-text">#{{ item.tag }}</strong>
55 fetchStatus: async function () {
56 if (this.item.subtitle != null) return; // omitting unnecessary ajax call as the subtitle is showing
57 var apikey = this.item.apikey;
59 const url = `${this.item.url}/api/meal-plans/today/`;
60 this.meal = await fetch(url, {
62 "Authorization": "Bearer " + this.item.apikey,
63 "Accept": "application/json"
66 .then(function(response) {
68 throw new Error("Not 2xx response")
70 if (response != null) {
71 return response.json();
75 .catch((e) => console.log(e));
77 const url = `${this.item.url}/api/debug/statistics/`;
78 this.stats = await fetch(url)
79 .then(function(response) {
81 throw new Error("Not 2xx response")
83 return response.json();
86 .catch((e) => console.log(e));
92 <style scoped lang="scss">