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>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<baseTemplate
|
<baseTemplate :currentCarInfo="pageHeader.Text" :neededCarInfo="radioQuestion.Question">
|
||||||
currentCarInfo="Select a year to get started"
|
<carAttributes :attritbutes="years" :selectAttribute="selectYear" />
|
||||||
neededCarInfo="What year is your vehicle?"
|
|
||||||
>
|
|
||||||
<carAttributes :attritbutes="years" :selectAttribute="selectYear" />
|
|
||||||
</baseTemplate>
|
</baseTemplate>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
@ -15,25 +12,49 @@ import carAttributes from "@/commonComponents/carAttributes/carAttributes";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "SelectCar",
|
name: "SelectCar",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
years: [],
|
years: [],
|
||||||
};
|
pageHeader: {},
|
||||||
},
|
radioQuestion: {}
|
||||||
mounted() {
|
};
|
||||||
axios.get("https://mockey.qa.sagaws.net/service/years").then((response) => {
|
},
|
||||||
this.years = response.data.Result;
|
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);
|
// 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>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import { storeActions } from "@/constants/storeActions.js";
|
import { storeActions } from "@/constants/storeActions.js";
|
||||||
|
import { widgetNames } from "@/constants/widgetNames.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
methods: {
|
methods: {
|
||||||
|
|
@ -18,5 +19,8 @@ export default {
|
||||||
storeActions() {
|
storeActions() {
|
||||||
return storeActions;
|
return storeActions;
|
||||||
},
|
},
|
||||||
|
widgetNames(){
|
||||||
|
return widgetNames;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue