Fixed axios base url
This commit is contained in:
parent
d1d3b35699
commit
56f8c19520
@ -12,7 +12,7 @@ import "pc-bootstrap4-datetimepicker/build/css/bootstrap-datetimepicker.css";
|
||||
import Icon from "vue-awesome/components/Icon";
|
||||
|
||||
Vue.config.productionTip = false;
|
||||
axios.defaults.baseUrl = "http://localhost:8090/api";
|
||||
axios.defaults.baseURL = "/api";
|
||||
Vue.use(VueAxios, axios);
|
||||
Vue.use(BootstrapVue);
|
||||
Vue.use(datePicker);
|
||||
|
@ -92,7 +92,7 @@ export default {
|
||||
mounted() {
|
||||
this.resetStore();
|
||||
Vue.axios
|
||||
.get("/api/site/all")
|
||||
.get("/site/all")
|
||||
.then(response => {
|
||||
this.siteOptions = response.data;
|
||||
this.loaded = true;
|
||||
@ -125,7 +125,7 @@ export default {
|
||||
]),
|
||||
getTutors: function() {
|
||||
if (this.site != null) {
|
||||
Vue.axios.get("/api/site/" + this.site + "/tutors").then(response => {
|
||||
Vue.axios.get("/site/" + this.site + "/tutors").then(response => {
|
||||
this.tutorOptions = response.data;
|
||||
this.loadingTutors = false;
|
||||
});
|
||||
|
@ -40,7 +40,7 @@ export default {
|
||||
var form = document.getElementById("submission-form");
|
||||
if (form.checkValidity()) {
|
||||
Vue.axios
|
||||
.post("/api/site", this.siteName)
|
||||
.post("/site", this.siteName)
|
||||
.then(response => {
|
||||
this.alertVariant = "success";
|
||||
this.alertText = "Successfully added " + response.data.name;
|
||||
|
@ -8,6 +8,9 @@
|
||||
<b-form-group horizontal label="Tutor Name">
|
||||
<b-form-input v-model="tutorName" type="text" style="text-align:center;" />
|
||||
</b-form-group>
|
||||
<b-form-group horizontal label="Password">
|
||||
<b-form-input v-model="submissionPassword" type="password" style="text-align:center;" />
|
||||
</b-form-group>
|
||||
<b-button type="submit" size="lg" variant="primary">Submit</b-button>
|
||||
</b-form>
|
||||
<br />
|
||||
@ -29,12 +32,13 @@ export default {
|
||||
dismissSecs: 5,
|
||||
dismissCountDown: 0,
|
||||
alertVariant: "info",
|
||||
alertText: ""
|
||||
alertText: "",
|
||||
submissionPassword: ""
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
Vue.axios
|
||||
.get("/api/site/all")
|
||||
.get("/site/all")
|
||||
.then(response => {
|
||||
this.siteOptions = response.data;
|
||||
})
|
||||
@ -54,9 +58,15 @@ export default {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
var form = document.getElementById("submission-form");
|
||||
let axiosConfig = {
|
||||
auth: {
|
||||
username: "test",
|
||||
password: this.submissionPassword
|
||||
}
|
||||
};
|
||||
if (form.checkValidity()) {
|
||||
Vue.axios
|
||||
.post("/api/tutor", {
|
||||
.post("/tutor", {
|
||||
siteId: this.siteSelection,
|
||||
name: this.tutorName
|
||||
})
|
||||
@ -70,7 +80,7 @@ export default {
|
||||
this.alertText = "Failed to add Tutor";
|
||||
this.showAlert();
|
||||
console.log(error);
|
||||
});
|
||||
}, axiosConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ export default {
|
||||
});
|
||||
if (form.checkValidity()) {
|
||||
Vue.axios
|
||||
.post("/api/observation", {
|
||||
.post("/observation", {
|
||||
siteId: this.site,
|
||||
tutorIds: this.tutors,
|
||||
observed: this.description,
|
||||
|
@ -12,6 +12,11 @@
|
||||
</div>
|
||||
</b-modal>
|
||||
<b-row>
|
||||
<b-col>
|
||||
<b-form-group label="Site">
|
||||
<b-form-select v-model="siteSelection" :options="siteOptions" style="text-align:center;" />
|
||||
</b-form-group>
|
||||
</b-col>
|
||||
<b-col>
|
||||
<b-form-group label="From">
|
||||
<date-picker v-model="startDate" :config="dateOptions" />
|
||||
@ -44,13 +49,15 @@ export default {
|
||||
dateOptions: {
|
||||
format: "DD/MM/YYYY",
|
||||
useCurrent: false
|
||||
}
|
||||
},
|
||||
siteSelection: null,
|
||||
siteOptions: null
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
getAllTimeAverage: function() {
|
||||
Vue.axios
|
||||
.get("/api/observation/average/all/chartjs")
|
||||
.get("/observation/average/all/chartjs")
|
||||
.then(response => {
|
||||
this.chartData = response.data;
|
||||
})
|
||||
@ -63,6 +70,17 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
this.getAllTimeAverage();
|
||||
Vue.axios
|
||||
.get("/site/all")
|
||||
.then(response => {
|
||||
this.siteOptions = response.data;
|
||||
this.loaded = true;
|
||||
})
|
||||
.catch(error => {
|
||||
this.errorStatus = error.response.status;
|
||||
this.errorMessage = error.response.data;
|
||||
this.$refs.errorModal.show();
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user