Added observation POST.
This commit is contained in:
parent
07622febd3
commit
94a23df7f9
@ -50,6 +50,7 @@
|
||||
<script>
|
||||
import "bootstrap/dist/css/bootstrap.css";
|
||||
import "bootstrap-vue/dist/bootstrap-vue.css";
|
||||
import { mapState } from "vuex";
|
||||
import Vue from "vue";
|
||||
export default {
|
||||
name: "observation",
|
||||
@ -65,6 +66,9 @@ export default {
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState(["site", "description", "type", "tutors"])
|
||||
},
|
||||
methods: {
|
||||
addAnotherObservation: function() {
|
||||
this.observations.push({
|
||||
@ -91,6 +95,27 @@ export default {
|
||||
e.stopPropagation();
|
||||
var form = document.getElementById("submission-form");
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user