Added mock case for grabbing content

This commit is contained in:
Frank 2021-11-04 15:53:15 -04:00
parent e5ac935964
commit fbf1f8c124
3 changed files with 57 additions and 26 deletions

View file

@ -0,0 +1,6 @@
const widgetNames = {
PAGE_HEADING_WIDGET: "PageHeadingWidget",
RADIO_QUESTION_WIDGET: "RadioQuestionWidget"
}
export { widgetNames }

View file

@ -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>

View file

@ -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;
}
}, },
} }