AccCourseWorkEdit: fix setting title on documents

This commit is contained in:
nobohan 2022-02-25 11:52:04 +01:00
parent 15487cd84c
commit 289d79e011
2 changed files with 5 additions and 15 deletions

View File

@ -76,7 +76,7 @@
class="form-control form-control-sm"
type="string"
:value=d.title
:id=i
:id=d.id
@input="onInputDocumentTitle"/>
</div>
</div>
@ -260,9 +260,9 @@ export default {
return this.$store.dispatch('submit', callback).catch(e => { console.log(e); throw e; });
},
onInputDocumentTitle(event) {
const id = event.target.id;
const id = Number(event.target.id);
const title = event.target.value;
this.$store.commit('updateDocumentTitle', {key: id, evaluationKey: this.evaluation.key, title: title});
this.$store.commit('updateDocumentTitle', {id: id, evaluationKey: this.evaluation.key, title: title});
},
addDocument(storedObject) {
console.log(storedObject);

View File

@ -295,18 +295,8 @@ const store = createStore({
state.isPosting = st;
},
updateDocumentTitle(state, payload) {
state.evaluationsPicked.forEach(
e => {
console.log(e);
if (e.key === payload.evaluationKey) {
e.documents.forEach(
d => {
d.title = payload.title;
}
)
}
}
)
state.evaluationsPicked.find(e => e.key === payload.evaluationKey)
.documents.find(d => d.id === payload.id).title = payload.title;
}
},
actions: {