Store commit of document duplication only upon successful API call otherwise log error

This commit is contained in:
2025-08-21 16:18:24 +02:00
parent 3abb76d268
commit 4d90c7028f

View File

@@ -611,6 +611,7 @@ const store = createStore({
commit("addDuplicatedDocument", { document: newDoc, evaluation_key });
},
async duplicateDocumentToEvaluation({ commit }, { document, evaluation }) {
try {
const newDoc = await duplicateDocumentToEvaluation(
document.id,
evaluation.id,
@@ -621,6 +622,10 @@ const store = createStore({
});
return newDoc;
} catch (error) {
console.error("Failed to move document:", error);
throw error;
}
},
removeDocument({ commit }, payload) {
commit("removeDocument", payload);