Added observation POST.
This commit is contained in:
parent
07622febd3
commit
94a23df7f9
@ -50,6 +50,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import "bootstrap/dist/css/bootstrap.css";
|
import "bootstrap/dist/css/bootstrap.css";
|
||||||
import "bootstrap-vue/dist/bootstrap-vue.css";
|
import "bootstrap-vue/dist/bootstrap-vue.css";
|
||||||
|
import { mapState } from "vuex";
|
||||||
import Vue from "vue";
|
import Vue from "vue";
|
||||||
export default {
|
export default {
|
||||||
name: "observation",
|
name: "observation",
|
||||||
@ -65,6 +66,9 @@ export default {
|
|||||||
]
|
]
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState(["site", "description", "type", "tutors"])
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
addAnotherObservation: function() {
|
addAnotherObservation: function() {
|
||||||
this.observations.push({
|
this.observations.push({
|
||||||
@ -91,6 +95,27 @@ export default {
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
var form = document.getElementById("submission-form");
|
var form = document.getElementById("submission-form");
|
||||||
console.log(form.checkValidity());
|
console.log(form.checkValidity());
|
||||||
|
if (form.checkValidity()) {
|
||||||
|
Vue.axios
|
||||||
|
.post("/api/observation", {
|
||||||
|
siteId: this.site,
|
||||||
|
tutorIds: this.tutors,
|
||||||
|
observed: this.description,
|
||||||
|
type: this.type,
|
||||||
|
monitoring: "",
|
||||||
|
control: "",
|
||||||
|
conservatism: "",
|
||||||
|
teamwork: "",
|
||||||
|
knowledge: "",
|
||||||
|
rawData: this.observations
|
||||||
|
})
|
||||||
|
.then(function(response) {
|
||||||
|
console.log(response);
|
||||||
|
})
|
||||||
|
.catch(function(error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
}
|
||||||
form.classList.add("was-validated");
|
form.classList.add("was-validated");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user