error messages
This commit is contained in:
parent
f177fed8e2
commit
b89c38a696
@ -10,9 +10,6 @@
|
|||||||
|
|
||||||
{% include 'include/vue_base.html' %}
|
{% include 'include/vue_base.html' %}
|
||||||
|
|
||||||
<link rel="stylesheet" href="{% static 'css/bootstrap-vue.min.css' %}">
|
|
||||||
<script src="{% static 'js/bootstrap-vue.min.js' %}"></script>
|
|
||||||
|
|
||||||
<link rel="stylesheet" href="{% static 'css/vue-multiselect-bs4.min.css' %}">
|
<link rel="stylesheet" href="{% static 'css/vue-multiselect-bs4.min.css' %}">
|
||||||
<script src="{% static 'js/vue-multiselect.min.js' %}"></script>
|
<script src="{% static 'js/vue-multiselect.min.js' %}"></script>
|
||||||
|
|
||||||
@ -450,6 +447,7 @@
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
makeToast: function(title, message, variant=null) {
|
makeToast: function(title, message, variant=null) {
|
||||||
|
//TODO remove duplicate function in favor of central one
|
||||||
this.$bvToast.toast(message, {
|
this.$bvToast.toast(message, {
|
||||||
title: title,
|
title: title,
|
||||||
variant: variant,
|
variant: variant,
|
||||||
|
@ -10,4 +10,7 @@
|
|||||||
|
|
||||||
<script src="{% static 'js/vue-resource.js' %}"></script>
|
<script src="{% static 'js/vue-resource.js' %}"></script>
|
||||||
|
|
||||||
<script src="{% static 'js/js.cookie.min.js' %}"></script>
|
<script src="{% static 'js/js.cookie.min.js' %}"></script>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="{% static 'css/bootstrap-vue.min.css' %}">
|
||||||
|
<script src="{% static 'js/bootstrap-vue.min.js' %}"></script>
|
||||||
|
@ -367,6 +367,15 @@
|
|||||||
this.getRecipes();
|
this.getRecipes();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
makeToast: function(title, message, variant=null) {
|
||||||
|
//TODO remove duplicate function in favor of central one
|
||||||
|
this.$bvToast.toast(message, {
|
||||||
|
title: title,
|
||||||
|
variant: variant,
|
||||||
|
toaster: 'b-toaster-top-center',
|
||||||
|
solid: true
|
||||||
|
})
|
||||||
|
},
|
||||||
updatePlan: function () {
|
updatePlan: function () {
|
||||||
let planEntryPromise = this.getPlanEntries();
|
let planEntryPromise = this.getPlanEntries();
|
||||||
let planTypePromise = this.getPlanTypes();
|
let planTypePromise = this.getPlanTypes();
|
||||||
@ -380,6 +389,7 @@
|
|||||||
this.plan_entries = response.data;
|
this.plan_entries = response.data;
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.log("getPlanEntries error: ", err);
|
console.log("getPlanEntries error: ", err);
|
||||||
|
this.makeToast('{% trans 'Error' %}','{% trans 'There was an error loading a resource!' %}' + err.bodyText, 'danger')
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getPlanTypes: function () {
|
getPlanTypes: function () {
|
||||||
@ -391,6 +401,7 @@
|
|||||||
}
|
}
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.log("getPlanTypes error: ", err);
|
console.log("getPlanTypes error: ", err);
|
||||||
|
this.makeToast('{% trans 'Error' %}','{% trans 'There was an error loading a resource!' %}' + err.bodyText, 'danger')
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
buildGrid: function () {
|
buildGrid: function () {
|
||||||
@ -440,6 +451,7 @@
|
|||||||
this.recipes = response.data;
|
this.recipes = response.data;
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.log("getRecipes error: ", err);
|
console.log("getRecipes error: ", err);
|
||||||
|
this.makeToast('{% trans 'Error' %}','{% trans 'There was an error loading a resource!' %}' + err.bodyText, 'danger')
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getMdNote: function () {
|
getMdNote: function () {
|
||||||
@ -452,6 +464,7 @@
|
|||||||
this.recipes = response.data;
|
this.recipes = response.data;
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.log("getRecipes error: ", err);
|
console.log("getRecipes error: ", err);
|
||||||
|
this.makeToast('{% trans 'Error' %}','{% trans 'There was an error loading a resource!' %}' + err.bodyText, 'danger')
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
updateUserNames: function () {
|
updateUserNames: function () {
|
||||||
@ -466,6 +479,7 @@
|
|||||||
|
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.log("updateUserNames error: ", err);
|
console.log("updateUserNames error: ", err);
|
||||||
|
this.makeToast('{% trans 'Error' %}','{% trans 'There was an error loading a resource!' %}' + err.bodyText, 'danger')
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
dragChanged: function (date, meal_type, evt) {
|
dragChanged: function (date, meal_type, evt) {
|
||||||
@ -491,6 +505,7 @@
|
|||||||
this.$http.put(`{% url 'api:mealplan-list' %}${plan_entry.id}/`, plan_entry).then((response) => {
|
this.$http.put(`{% url 'api:mealplan-list' %}${plan_entry.id}/`, plan_entry).then((response) => {
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.log("dragChanged update error", err);
|
console.log("dragChanged update error", err);
|
||||||
|
this.makeToast('{% trans 'Error' %}','{% trans 'There was an error loading a resource!' %}' + err.bodyText, 'danger')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -501,6 +516,7 @@
|
|||||||
this.meal_plan[entry.meal_type_name].days[entry.date].items = this.meal_plan[entry.meal_type_name].days[entry.date].items.filter(item => item !== entry)
|
this.meal_plan[entry.meal_type_name].days[entry.date].items = this.meal_plan[entry.meal_type_name].days[entry.date].items.filter(item => item !== entry)
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.log("deleteEntry error: ", err);
|
console.log("deleteEntry error: ", err);
|
||||||
|
this.makeToast('{% trans 'Error' %}','{% trans 'There was an error loading a resource!' %}' + err.bodyText, 'danger')
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
updatePlanTypes: function () {
|
updatePlanTypes: function () {
|
||||||
@ -514,12 +530,14 @@
|
|||||||
promise_list.push(this.$http.post("{% url 'api:mealtype-list' %}", x).then((response) => {
|
promise_list.push(this.$http.post("{% url 'api:mealtype-list' %}", x).then((response) => {
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.log("updatePlanTypes create error: ", err);
|
console.log("updatePlanTypes create error: ", err);
|
||||||
|
this.makeToast('{% trans 'Error' %}','{% trans 'There was an error loading a resource!' %}' + err.bodyText, 'danger')
|
||||||
}))
|
}))
|
||||||
} else if (x.delete) {
|
} else if (x.delete) {
|
||||||
if (x.id !== undefined) {
|
if (x.id !== undefined) {
|
||||||
promise_list.push(this.$http.delete(`{% url 'api:mealtype-list' %}${x.id}/`, x).then((response) => {
|
promise_list.push(this.$http.delete(`{% url 'api:mealtype-list' %}${x.id}/`, x).then((response) => {
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.log("updatePlanTypes delete error: ", err);
|
console.log("updatePlanTypes delete error: ", err);
|
||||||
|
this.makeToast('{% trans 'Error' %}','{% trans 'There was an error loading a resource!' %}' + err.bodyText, 'danger')
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -527,6 +545,7 @@
|
|||||||
|
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.log("updatePlanTypes update error: ", err);
|
console.log("updatePlanTypes update error: ", err);
|
||||||
|
this.makeToast('{% trans 'Error' %}','{% trans 'There was an error loading a resource!' %}' + err.bodyText, 'danger')
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -281,6 +281,15 @@
|
|||||||
this.searchIngredients('')
|
this.searchIngredients('')
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
makeToast: function (title, message, variant = null) {
|
||||||
|
//TODO remove duplicate function in favor of central one
|
||||||
|
this.$bvToast.toast(message, {
|
||||||
|
title: title,
|
||||||
|
variant: variant,
|
||||||
|
toaster: 'b-toaster-top-center',
|
||||||
|
solid: true
|
||||||
|
})
|
||||||
|
},
|
||||||
loadRecipe: function () {
|
loadRecipe: function () {
|
||||||
this.recipe_data = undefined
|
this.recipe_data = undefined
|
||||||
this.error = undefined
|
this.error = undefined
|
||||||
@ -292,6 +301,7 @@
|
|||||||
this.error = err.data
|
this.error = err.data
|
||||||
this.loading = false
|
this.loading = false
|
||||||
console.log(err)
|
console.log(err)
|
||||||
|
this.makeToast('{% trans 'Error' %}','{% trans 'There was an error loading a resource!' %}' + err.bodyText, 'danger')
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
importRecipe: function () {
|
importRecipe: function () {
|
||||||
@ -299,7 +309,8 @@
|
|||||||
this.$http.post(`{% url 'data_import_url' %}`, this.recipe_data).then((response) => {
|
this.$http.post(`{% url 'data_import_url' %}`, this.recipe_data).then((response) => {
|
||||||
location.href = response.data
|
location.href = response.data
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.log("dragChanged create error", err);
|
console.log(err);
|
||||||
|
this.makeToast('{% trans 'Error' %}','{% trans 'An error occurred while trying to import this recipe!' %}' + err.bodyText, 'danger')
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
deleteIngredient: function (i) {
|
deleteIngredient: function (i) {
|
||||||
@ -341,6 +352,7 @@
|
|||||||
this.keywords_loading = false
|
this.keywords_loading = false
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
|
this.makeToast('{% trans 'Error' %}','{% trans 'There was an error loading a resource!' %}' + err.bodyText, 'danger')
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
searchUnits: function (query) {
|
searchUnits: function (query) {
|
||||||
@ -358,6 +370,7 @@
|
|||||||
this.units_loading = false
|
this.units_loading = false
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
|
this.makeToast('{% trans 'Error' %}','{% trans 'There was an error loading a resource!' %}' + err.bodyText, 'danger')
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
searchIngredients: function (query) {
|
searchIngredients: function (query) {
|
||||||
@ -376,6 +389,7 @@
|
|||||||
this.ingredients_loading = false
|
this.ingredients_loading = false
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
|
this.makeToast('{% trans 'Error' %}','{% trans 'There was an error loading a resource!' %}' + err.bodyText, 'danger')
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user