mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2025-12-25 03:13:13 -05:00
fix url_import
This commit is contained in:
@@ -660,13 +660,14 @@
|
||||
|
||||
</div>
|
||||
|
||||
<script src="{% url 'javascript-catalog' %}"></script>
|
||||
<script src="{% url 'javascript-catalog' %}">
|
||||
</script>
|
||||
<script type="application/javascript">
|
||||
let csrftoken = Cookies.get('csrftoken');
|
||||
Vue.http.headers.common['X-CSRFToken'] = csrftoken;
|
||||
|
||||
Vue.component('vue-multiselect', window.VueMultiselect.default)
|
||||
import { ApiApiFactory } from "@/utils/openapi/api"
|
||||
|
||||
|
||||
let app = new Vue({
|
||||
components: {
|
||||
@@ -885,27 +886,27 @@
|
||||
this.$set(this.$refs.ingredient[index].$data, 'search', this.recipe_data.recipeIngredient[index].ingredient.text)
|
||||
},
|
||||
searchKeywords: function (query) {
|
||||
// this.keywords_loading = true
|
||||
// this.$http.get("{% url 'dal_keyword' %}" + '?q=' + query).then((response) => {
|
||||
// this.keywords = response.data.results;
|
||||
// this.keywords_loading = false
|
||||
// }).catch((err) => {
|
||||
// console.log(err)
|
||||
// this.makeToast(gettext('Error'), gettext('There was an error loading a resource!') + err.bodyText, 'danger')
|
||||
// })
|
||||
let apiFactory = new ApiApiFactory()
|
||||
|
||||
this.keywords_loading = true
|
||||
apiFactory
|
||||
.listKeywords(query, undefined, undefined, 1, this.options_limit)
|
||||
.then((response) => {
|
||||
this.keywords = response.data.results
|
||||
this.keywords_loading = false
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err)
|
||||
StandardToasts.makeStandardToast(StandardToasts.FAIL_FETCH)
|
||||
})
|
||||
this.$http.get("{% url 'dal_keyword' %}" + '?q=' + query).then((response) => {
|
||||
this.keywords = response.data.results;
|
||||
this.keywords_loading = false
|
||||
}).catch((err) => {
|
||||
console.log(err)
|
||||
this.makeToast(gettext('Error'), gettext('There was an error loading a resource!') + err.bodyText, 'danger')
|
||||
})
|
||||
// let apiFactory = new ApiApiFactory()
|
||||
|
||||
// this.keywords_loading = true
|
||||
// apiFactory
|
||||
// .listKeywords(query, undefined, undefined, 1, this.options_limit)
|
||||
// .then((response) => {
|
||||
// this.keywords = response.data.results
|
||||
// this.keywords_loading = false
|
||||
// })
|
||||
// .catch((err) => {
|
||||
// console.log(err)
|
||||
// StandardToasts.makeStandardToast(StandardToasts.FAIL_FETCH)
|
||||
// })
|
||||
},
|
||||
searchUnits: function (query) {
|
||||
let apiFactory = new ApiApiFactory()
|
||||
@@ -932,46 +933,46 @@
|
||||
})
|
||||
},
|
||||
searchIngredients: function (query) {
|
||||
// this.ingredients_loading = true
|
||||
// this.$http.get("{% url 'dal_food' %}" + '?q=' + query).then((response) => {
|
||||
// this.ingredients = response.data.results
|
||||
// if (this.recipe_data !== undefined) {
|
||||
// for (let x of Array.from(this.recipe_data.recipeIngredient)) {
|
||||
// if (x.ingredient.text !== '') {
|
||||
// this.ingredients = this.ingredients.filter(item => item.text !== x.ingredient.text)
|
||||
// this.ingredients.push(x.ingredient)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// this.ingredients_loading = false
|
||||
// }).catch((err) => {
|
||||
// console.log(err)
|
||||
// this.makeToast(gettext('Error'), gettext('There was an error loading a resource!') + err.bodyText, 'danger')
|
||||
// })
|
||||
let apiFactory = new ApiApiFactory()
|
||||
|
||||
this.foods_loading = true
|
||||
apiFactory
|
||||
.listFoods(query, undefined, undefined, 1, this.options_limit)
|
||||
.then((response) => {
|
||||
this.foods = response.data.results
|
||||
|
||||
if (this.recipe !== undefined) {
|
||||
for (let s of this.recipe.steps) {
|
||||
for (let i of s.ingredients) {
|
||||
if (i.food !== null && i.food.id === undefined) {
|
||||
this.foods.push(i.food)
|
||||
}
|
||||
}
|
||||
this.ingredients_loading = true
|
||||
this.$http.get("{% url 'dal_food' %}" + '?q=' + query).then((response) => {
|
||||
this.ingredients = response.data.results
|
||||
if (this.recipe_data !== undefined) {
|
||||
for (let x of Array.from(this.recipe_data.recipeIngredient)) {
|
||||
if (x.ingredient.text !== '') {
|
||||
this.ingredients = this.ingredients.filter(item => item.text !== x.ingredient.text)
|
||||
this.ingredients.push(x.ingredient)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.foods_loading = false
|
||||
})
|
||||
.catch((err) => {
|
||||
StandardToasts.makeStandardToast(StandardToasts.FAIL_FETCH)
|
||||
})
|
||||
this.ingredients_loading = false
|
||||
}).catch((err) => {
|
||||
console.log(err)
|
||||
this.makeToast(gettext('Error'), gettext('There was an error loading a resource!') + err.bodyText, 'danger')
|
||||
})
|
||||
// let apiFactory = new ApiApiFactory()
|
||||
|
||||
// this.foods_loading = true
|
||||
// apiFactory
|
||||
// .listFoods(query, undefined, undefined, 1, this.options_limit)
|
||||
// .then((response) => {
|
||||
// this.foods = response.data.results
|
||||
|
||||
// if (this.recipe !== undefined) {
|
||||
// for (let s of this.recipe.steps) {
|
||||
// for (let i of s.ingredients) {
|
||||
// if (i.food !== null && i.food.id === undefined) {
|
||||
// this.foods.push(i.food)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// this.foods_loading = false
|
||||
// })
|
||||
// .catch((err) => {
|
||||
// StandardToasts.makeStandardToast(StandardToasts.FAIL_FETCH)
|
||||
// })
|
||||
},
|
||||
deleteNode: function (node, item, e) {
|
||||
e.stopPropagation()
|
||||
|
||||
Reference in New Issue
Block a user