visgraph: fix body in POST relationship query

This commit is contained in:
2021-11-02 16:34:01 +01:00
parent 024531fbe1
commit 6b31bf225a
3 changed files with 35 additions and 14 deletions

View File

@@ -62,7 +62,7 @@
</VueMultiselect>
</div>
<div v-if="relation && relation.title && relation.reverseTitle">
<p class="text-center" v-if="reverse">
<p class="text-start" v-if="reverse">
{{ $t('visgraph.relation_from_to_like', [
getPerson(modal.data.to).text,
getPerson(modal.data.from).text,
@@ -75,7 +75,7 @@
relation.reverseTitle.fr.toLowerCase(),
])}}
</p>
<p class="text-center" v-else>
<p class="text-start" v-else>
{{ $t('visgraph.relation_from_to_like', [
getPerson(modal.data.from).text,
getPerson(modal.data.to).text,
@@ -102,7 +102,7 @@
</div>
</template>
<template v-slot:footer>
<button class="btn" :class="modal.button.class" @click="modal.showModal = false">
<button class="btn" :class="modal.button.class" @click="submitRelationship">
{{ $t(modal.button.text)}}</button>
</template>
</modal>
@@ -115,7 +115,7 @@ import vis from 'vis-network/dist/vis-network'
import { mapState, mapGetters } from "vuex"
import Modal from 'ChillMainAssets/vuejs/_components/Modal'
import VueMultiselect from 'vue-multiselect'
import { getRelationsList } from "./api";
import { getRelationsList, postRelationship } from "./api";
export default {
name: "App",
@@ -192,7 +192,7 @@ export default {
return this.relation
},
set(value) {
console.log('setter relation', value) // <=== InternalError: too much recursion
//console.log('setter relation', value) // <=== InternalError: too much recursion
this.relation = value
}
},
@@ -202,7 +202,7 @@ export default {
return this.reverse
},
set(value) {
console.log('setter reverse', value) // <=== InternalError: too much recursion
//console.log('setter reverse', value) // <=== InternalError: too much recursion
this.reverse = value
}
},
@@ -299,6 +299,21 @@ export default {
getPerson(idtext) {
let person = this.persons.filter(p => p.id === idtext)
return person[0]
},
submitRelationship() {
console.log('submitRelationship')
return postRelationship(
this.getPerson(this.modal.data.from),
this.getPerson(this.modal.data.to),
this.relation,
this.reverse
)
.then(response => new Promise(resolve =>{
console.log('', response)
modal.showModal = false
resolve()
}))
.catch()
}
}
}
@@ -317,4 +332,7 @@ div#visgraph-legend {
div.post-menu.legend {
}
}
.modal-mask {
background-color: rgba(0, 0, 0, 0.25);
}
</style>