Added mock case for grabbing content
This commit is contained in:
parent
e5ac935964
commit
fbf1f8c124
3 changed files with 57 additions and 26 deletions
6
src/constants/widgetNames.js
Normal file
6
src/constants/widgetNames.js
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
const widgetNames = {
|
||||
PAGE_HEADING_WIDGET: "PageHeadingWidget",
|
||||
RADIO_QUESTION_WIDGET: "RadioQuestionWidget"
|
||||
}
|
||||
|
||||
export { widgetNames }
|
||||
|
|
@ -1,12 +1,9 @@
|
|||
<template>
|
||||
<div>
|
||||
<baseTemplate
|
||||
currentCarInfo="Select a year to get started"
|
||||
neededCarInfo="What year is your vehicle?"
|
||||
>
|
||||
<carAttributes :attritbutes="years" :selectAttribute="selectYear" />
|
||||
<div>
|
||||
<baseTemplate :currentCarInfo="pageHeader.Text" :neededCarInfo="radioQuestion.Question">
|
||||
<carAttributes :attritbutes="years" :selectAttribute="selectYear" />
|
||||
</baseTemplate>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
|
@ -15,25 +12,49 @@ import carAttributes from "@/commonComponents/carAttributes/carAttributes";
|
|||
import axios from "axios";
|
||||
|
||||
export default {
|
||||
name: "SelectCar",
|
||||
data() {
|
||||
return {
|
||||
years: [],
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
axios.get("https://mockey.qa.sagaws.net/service/years").then((response) => {
|
||||
this.years = response.data.Result;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
selectYear(year) {
|
||||
this.$store.dispatch("selectYear", year);
|
||||
name: "SelectCar",
|
||||
data() {
|
||||
return {
|
||||
years: [],
|
||||
pageHeader: {},
|
||||
radioQuestion: {}
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
axios.get("https://mockey.qa.sagaws.net/service/years").then((response) => {
|
||||
this.years = response.data.Result;
|
||||
});
|
||||
|
||||
// Sample Call to Mockey to represent real data being sent back from the API, and how the modles are supposed to
|
||||
// be prosessed and passed to child components.
|
||||
axios.get("https://mockey.qa.sagaws.net/service/content/selectYear").then((response) => {
|
||||
|
||||
response.data.Result.forEach((m) => {
|
||||
switch (m.Type) {
|
||||
case this.widgetNames.PAGE_HEADING_WIDGET: {
|
||||
this.pageHeader = m.Model;
|
||||
break;
|
||||
}
|
||||
case this.widgetNames.RADIO_QUESTION_WIDGET: {
|
||||
this.radioQuestion = m.Model;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
selectYear(year) {
|
||||
this.$store.dispatch("selectYear", year);
|
||||
},
|
||||
},
|
||||
components: {
|
||||
baseTemplate,
|
||||
carAttributes,
|
||||
},
|
||||
},
|
||||
components: {
|
||||
baseTemplate,
|
||||
carAttributes,
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { storeActions } from "@/constants/storeActions.js";
|
||||
import { widgetNames } from "@/constants/widgetNames.js";
|
||||
|
||||
export default {
|
||||
methods: {
|
||||
|
|
@ -18,5 +19,8 @@ export default {
|
|||
storeActions() {
|
||||
return storeActions;
|
||||
},
|
||||
widgetNames(){
|
||||
return widgetNames;
|
||||
}
|
||||
},
|
||||
}
|
||||
Loading…
Reference in a new issue