aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/components/services/Mealie.vue55
1 files changed, 28 insertions, 27 deletions
diff --git a/src/components/services/Mealie.vue b/src/components/services/Mealie.vue
index 7224bf4..acff1fb 100644
--- a/src/components/services/Mealie.vue
+++ b/src/components/services/Mealie.vue
@@ -55,35 +55,36 @@ export default {
55 fetchStatus: async function () { 55 fetchStatus: async function () {
56 if (this.item.subtitle != null) return; // omitting unnecessary ajax call as the subtitle is showing 56 if (this.item.subtitle != null) return; // omitting unnecessary ajax call as the subtitle is showing
57 var apikey = this.item.apikey; 57 var apikey = this.item.apikey;
58 if (apikey) { 58 this.meal = await fetch(`${this.item.url}/api/meal-plans/today/`, {
59 const url = `${this.item.url}/api/meal-plans/today/`; 59 headers: {
60 this.meal = await fetch(url, { 60 "Authorization": "Bearer " + this.item.apikey,
61 headers: { 61 "Accept": "application/json"
62 "Authorization": "Bearer " + this.item.apikey, 62 }
63 "Accept": "application/json" 63 })
64 } 64 .then(function(response) {
65 }) 65 if (!response.ok) {
66 .then(function(response) { 66 throw new Error("Not 2xx response")
67 if (!response.ok) { 67 } else {
68 throw new Error("Not 2xx response") 68 if (response != null) {
69 } else {
70 if (response != null) {
71 return response.json();
72 }
73 }
74 })
75 .catch((e) => console.log(e));
76 }
77 const url = `${this.item.url}/api/debug/statistics/`;
78 this.stats = await fetch(url)
79 .then(function(response) {
80 if (!response.ok) {
81 throw new Error("Not 2xx response")
82 } else {
83 return response.json(); 69 return response.json();
84 } 70 }
85 }) 71 }
86 .catch((e) => console.log(e)); 72 })
73 .catch((e) => console.log(e));
74 this.stats = await fetch(`${this.item.url}/api/debug/statistics/`, {
75 headers: {
76 "Authorization": "Bearer " + this.item.apikey,
77 "Accept": "application/json"
78 }
79 })
80 .then(function(response) {
81 if (!response.ok) {
82 throw new Error("Not 2xx response")
83 } else {
84 return response.json();
85 }
86 })
87 .catch((e) => console.log(e));
87 }, 88 },
88 }, 89 },
89}; 90};