This commit is contained in:
Max 2021-10-29 16:40:18 -04:00
parent 1339b2dc5f
commit a21c5c61c1
4 changed files with 18 additions and 15 deletions

View file

@ -2,14 +2,14 @@
<form class="list-view d-flex">
<div class="car_list">
<div v-for="attritbute in attritbutes" :key="attritbute" class="mb-2">
<buttonPrimary :buttonText="attritbute" v-on:click="selectAttribute(attritbute)" buttonType="btn-funnel" />
<listButton :buttonText="attritbute" v-on:click="selectAttribute(attritbute)" />
</div>
</div>
</form>
</template>
<script>
import buttonPrimary from "@/uxComponents/buttonPrimary/buttonPrimary";
import listButton from "@/uxComponents/listButton/listButton";
export default {
name: "CarAttributes",
@ -18,7 +18,7 @@ export default {
selectAttribute: Function,
},
components: {
buttonPrimary,
listButton,
},
};
</script>

View file

@ -22,7 +22,7 @@ export default {
};
},
mounted() {
axios.get("https://mockey.qa.sagaws.net/service/years").then((response) => {
axios.get("https://consumerapidev.safelite.com/vehicle/api/v1/vehicle/years").then((response) => {
this.years = response.data.Result;
});
},

View file

@ -4,6 +4,8 @@ import { lazyLoadComponent } from "@/router/dynamic-routing/component-loader.js"
import NotFound from "@/layouts/notFound/notFound.vue";
import Home from "@/layouts/home/home.vue";
import store from "@/store";
import selectYear from "@/layouts/selectYear/selectYear.vue"
import selectMake from "@/layouts/selectMake/selectMake.vue"
const routes = [
{
@ -16,6 +18,16 @@ const routes = [
Name: "Home",
component: Home,
},
{
path: "/select-year",
name: "selectYear",
component: selectYear,
},
{
path: "/select-make",
name: "selectMake",
component: selectMake,
},
];
const router = createRouter({

View file

@ -27,7 +27,7 @@ export default createStore({
mutations: {
updateYear(state, data) {
state.year = data.year;
state.makes = data.makes;
state.makes = data.makes.data.Result;
state.slideTransition = "slide";
},
updateMake(state, data) {
@ -56,16 +56,7 @@ export default createStore({
},
actions: {
async selectYear(context, year) {
let makes = [];
await globalMethods
.callHttpClient({
method: "GET",
endpoint: `https://mockey.qa.sagaws.net/service/makes/year=${year}`,
payload: {},
})
.then(function (response) {
makes = response.data.Result;
});
const makes = await axios.get(`https://mockey.qa.sagaws.net/service/makes/year=${year}`);
context.commit("updateYear", { year, makes });
router.push(`/select-make?year=${year}`);
},