mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 23:23:51 +00:00
Store commit of document duplication only upon successful API call otherwise log error
This commit is contained in:
@@ -611,16 +611,21 @@ const store = createStore({
|
|||||||
commit("addDuplicatedDocument", { document: newDoc, evaluation_key });
|
commit("addDuplicatedDocument", { document: newDoc, evaluation_key });
|
||||||
},
|
},
|
||||||
async duplicateDocumentToEvaluation({ commit }, { document, evaluation }) {
|
async duplicateDocumentToEvaluation({ commit }, { document, evaluation }) {
|
||||||
const newDoc = await duplicateDocumentToEvaluation(
|
try {
|
||||||
document.id,
|
const newDoc = await duplicateDocumentToEvaluation(
|
||||||
evaluation.id,
|
document.id,
|
||||||
);
|
evaluation.id,
|
||||||
commit("addDuplicatedDocumentToEvaluation", {
|
);
|
||||||
document: newDoc,
|
commit("addDuplicatedDocumentToEvaluation", {
|
||||||
evaluation,
|
document: newDoc,
|
||||||
});
|
evaluation,
|
||||||
|
});
|
||||||
|
|
||||||
return newDoc;
|
return newDoc;
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Failed to move document:", error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
removeDocument({ commit }, payload) {
|
removeDocument({ commit }, payload) {
|
||||||
commit("removeDocument", payload);
|
commit("removeDocument", payload);
|
||||||
|
Reference in New Issue
Block a user