dynamic macros count

This commit is contained in:
sanjayk03-dev
2024-01-28 15:06:35 +05:30
parent fcfe972938
commit bea892ac52
5 changed files with 47 additions and 22 deletions

View File

@@ -298,5 +298,21 @@ module.exports = {
alert("Restore failed");
}
},
addNewMacros: async function () {
const length = this.config.macros.length;
const newMacros = {
name: `Macros ${length + 1}`,
color: "#dedede",
file_name: "",
};
this.config.macros.push(newMacros);
try {
await api.put("config/save", this.config);
this.$dispatch("update");
} catch (error) {
console.error("Restore Failed: ", error);
alert("Restore failed");
}
},
},
};