Updated Home to using store.
This commit is contained in:
parent
15c5e6d39c
commit
eb0c5abc7b
@ -30,7 +30,7 @@
|
|||||||
<b-col>
|
<b-col>
|
||||||
<b-form-group label="Tutor(s)">
|
<b-form-group label="Tutor(s)">
|
||||||
<p v-if="site == null">Select a site first.</p>
|
<p v-if="site == null">Select a site first.</p>
|
||||||
<v-icon name="spinner" spin v-if="loadingTutors"/>
|
<v-icon name="spinner" spin v-if="loadingTutors" />
|
||||||
<b-form-checkbox-group :value="tutors" @input="setTutors" :options="tutorOptions"></b-form-checkbox-group>
|
<b-form-checkbox-group :value="tutors" @input="setTutors" :options="tutorOptions"></b-form-checkbox-group>
|
||||||
</b-form-group>
|
</b-form-group>
|
||||||
</b-col>
|
</b-col>
|
||||||
@ -44,28 +44,28 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Vue from 'vue'
|
import Vue from "vue";
|
||||||
import 'vue-awesome/icons/spinner';
|
import "vue-awesome/icons/spinner";
|
||||||
import { mapState, mapMutations } from 'vuex'
|
import { mapState, mapMutations } from "vuex";
|
||||||
export default {
|
export default {
|
||||||
name: "home",
|
name: "home",
|
||||||
data () {
|
data() {
|
||||||
return {
|
return {
|
||||||
siteOptions: [],
|
siteOptions: [],
|
||||||
tutorOptions: [],
|
tutorOptions: [],
|
||||||
loadingTutors: false
|
loadingTutors: false
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted() {
|
||||||
Vue.axios.get("/api/site/all").then((response) => {
|
Vue.axios.get("/api/site/all").then(response => {
|
||||||
this.siteOptions = response.data;
|
this.siteOptions = response.data;
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(["site", "description", "type", "tutors"])
|
...mapState(["site", "description", "type", "tutors"])
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
site: function () {
|
site: function() {
|
||||||
this.loadingTutors = true;
|
this.loadingTutors = true;
|
||||||
this.tutorOptions = [];
|
this.tutorOptions = [];
|
||||||
this.tutors = [];
|
this.tutors = [];
|
||||||
@ -74,12 +74,12 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapMutations(["setSite", "setDescription", "setType", "setTutors"]),
|
...mapMutations(["setSite", "setDescription", "setType", "setTutors"]),
|
||||||
getTutors: function () {
|
getTutors: function() {
|
||||||
if(this.site != null){
|
if (this.site != null) {
|
||||||
Vue.axios.get("/api/tutor/site/" + this.site).then((response) => {
|
Vue.axios.get("/api/tutor/site/" + this.site).then(response => {
|
||||||
this.tutorOptions = response.data;
|
this.tutorOptions = response.data;
|
||||||
this.loadingTutors = false;
|
this.loadingTutors = false;
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user