delete bookmarklet on import

This commit is contained in:
smilerz 2021-03-29 15:11:54 -05:00
parent 4d4af5fdf2
commit b26aea96f4

View File

@ -756,6 +756,15 @@
this.makeToast(gettext('Error'), gettext('There was an error loading bookmarklet!') + err.bodyText, 'danger')
})
},
deleteBookmarklet: function(id_bkmk) {
this.error = undefined
this.$http.delete("{% url 'api:bookmarkletimport-list' %}" + id_bkmk +"/").then((response) => {
}).catch((err) => {
this.error = err.data
console.log(err)
this.makeToast(gettext('Error'), gettext('There was an error deleting bookmarklet!') + err.bodyText, 'danger')
})
},
loadRecipeManual: function () {
this.error = undefined
this.preview = false
@ -789,6 +798,12 @@
this.importing_recipe = true
this.$set(this.recipe_data, 'all_keywords', this.all_keywords)
this.$http.post(`{% url 'data_import_url' %}`, this.recipe_data).then((response) => {
let uri = window.location.search.substring(1);
let params = new URLSearchParams(uri);
q = params.get("id")
if (q) {
this.deleteBookmarklet(q)
}
window.location.href = response.data
}).catch((err) => {
console.log(err);