aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/components/services
diff options
context:
space:
mode:
authorBastien Wirtz <bastien.wirtz@gmail.com>2021-09-25 12:12:22 +0200
committerBastien Wirtz <bastien.wirtz@gmail.com>2021-09-25 12:18:13 +0200
commit1d3287dcca801a000dbdb40ef20fd26a97ebb2e3 (patch)
tree1d686bb1ddc88becccd25a4e7f1f34453561b711 /src/components/services
parent6173d7df609bc3ab071d5d9e34ce1eb1cb05d99e (diff)
downloadhomer-1d3287dcca801a000dbdb40ef20fd26a97ebb2e3.tar.gz
homer-1d3287dcca801a000dbdb40ef20fd26a97ebb2e3.tar.zst
homer-1d3287dcca801a000dbdb40ef20fd26a97ebb2e3.zip
Apply linters
Diffstat (limited to 'src/components/services')
-rw-r--r--src/components/services/Mealie.vue51
1 files changed, 24 insertions, 27 deletions
diff --git a/src/components/services/Mealie.vue b/src/components/services/Mealie.vue
index acff1fb..790a9b1 100644
--- a/src/components/services/Mealie.vue
+++ b/src/components/services/Mealie.vue
@@ -20,9 +20,7 @@
20 <template v-if="item.subtitle"> 20 <template v-if="item.subtitle">
21 {{ item.subtitle }} 21 {{ item.subtitle }}
22 </template> 22 </template>
23 <template v-else-if="meal"> 23 <template v-else-if="meal"> Today: {{ meal.name }} </template>
24 Today: {{ meal.name }}
25 </template>
26 <template v-else-if="stats"> 24 <template v-else-if="stats">
27 happily keeping {{ stats.totalRecipes }} recipes organized 25 happily keeping {{ stats.totalRecipes }} recipes organized
28 </template> 26 </template>
@@ -54,37 +52,36 @@ export default {
54 methods: { 52 methods: {
55 fetchStatus: async function () { 53 fetchStatus: async function () {
56 if (this.item.subtitle != null) return; // omitting unnecessary ajax call as the subtitle is showing 54 if (this.item.subtitle != null) return; // omitting unnecessary ajax call as the subtitle is showing
57 var apikey = this.item.apikey;
58 this.meal = await fetch(`${this.item.url}/api/meal-plans/today/`, { 55 this.meal = await fetch(`${this.item.url}/api/meal-plans/today/`, {
59 headers: { 56 headers: {
60 "Authorization": "Bearer " + this.item.apikey, 57 Authorization: "Bearer " + this.item.apikey,
61 "Accept": "application/json" 58 Accept: "application/json",
62 } 59 },
63 }) 60 })
64 .then(function(response) { 61 .then(function (response) {
65 if (!response.ok) { 62 if (!response.ok) {
66 throw new Error("Not 2xx response") 63 throw new Error("Not 2xx response");
67 } else { 64 } else {
68 if (response != null) { 65 if (response != null) {
69 return response.json(); 66 return response.json();
67 }
70 } 68 }
71 } 69 })
72 }) 70 .catch((e) => console.log(e));
73 .catch((e) => console.log(e));
74 this.stats = await fetch(`${this.item.url}/api/debug/statistics/`, { 71 this.stats = await fetch(`${this.item.url}/api/debug/statistics/`, {
75 headers: { 72 headers: {
76 "Authorization": "Bearer " + this.item.apikey, 73 Authorization: "Bearer " + this.item.apikey,
77 "Accept": "application/json" 74 Accept: "application/json",
78 } 75 },
79 }) 76 })
80 .then(function(response) { 77 .then(function (response) {
81 if (!response.ok) { 78 if (!response.ok) {
82 throw new Error("Not 2xx response") 79 throw new Error("Not 2xx response");
83 } else { 80 } else {
84 return response.json(); 81 return response.json();
85 } 82 }
86 }) 83 })
87 .catch((e) => console.log(e)); 84 .catch((e) => console.log(e));
88 }, 85 },
89 }, 86 },
90}; 87};