fixinf delele_current
This commit is contained in:
@@ -279,7 +279,11 @@ module.exports = {
|
||||
},
|
||||
delete_current: async function () {
|
||||
const filename = this.fileName;
|
||||
const macro_with_filename = this.state.macros.filter(
|
||||
if (filename == "default") {
|
||||
this.newGcode = "";
|
||||
} else {
|
||||
this.config.macros = [...this.state.macros];
|
||||
const macro_with_filename = this.config.macros.filter(
|
||||
item => item.file_name != "default" && item.file_name == this.fileName,
|
||||
);
|
||||
if (macro_with_filename.length != 0) {
|
||||
@@ -291,14 +295,11 @@ module.exports = {
|
||||
item.file_name = "default";
|
||||
});
|
||||
}
|
||||
if (filename == "default") {
|
||||
this.newGcode = "";
|
||||
} else {
|
||||
api.delete(`file/${filename}`);
|
||||
this.newGcode = "";
|
||||
this.config.macros_list = [...this.state.macros_list];
|
||||
this.config.macros_list = this.config.macros_list.filter(item => item.file_name !== filename);
|
||||
}
|
||||
this.fileName = "default";
|
||||
try {
|
||||
await api.put("config/save", this.config);
|
||||
this.$dispatch("update");
|
||||
@@ -306,7 +307,7 @@ module.exports = {
|
||||
console.error("Restore Failed: ", error);
|
||||
alert("Restore failed");
|
||||
}
|
||||
this.fileName = "default";
|
||||
}
|
||||
this.deleteGCode = false;
|
||||
},
|
||||
clear_macro: async function () {
|
||||
|
||||
Reference in New Issue
Block a user