edits
This commit is contained in:
parent
1339b2dc5f
commit
a21c5c61c1
4 changed files with 18 additions and 15 deletions
|
|
@ -2,14 +2,14 @@
|
||||||
<form class="list-view d-flex">
|
<form class="list-view d-flex">
|
||||||
<div class="car_list">
|
<div class="car_list">
|
||||||
<div v-for="attritbute in attritbutes" :key="attritbute" class="mb-2">
|
<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>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import buttonPrimary from "@/uxComponents/buttonPrimary/buttonPrimary";
|
import listButton from "@/uxComponents/listButton/listButton";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "CarAttributes",
|
name: "CarAttributes",
|
||||||
|
|
@ -18,7 +18,7 @@ export default {
|
||||||
selectAttribute: Function,
|
selectAttribute: Function,
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
buttonPrimary,
|
listButton,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ export default {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
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;
|
this.years = response.data.Result;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@ import { lazyLoadComponent } from "@/router/dynamic-routing/component-loader.js"
|
||||||
import NotFound from "@/layouts/notFound/notFound.vue";
|
import NotFound from "@/layouts/notFound/notFound.vue";
|
||||||
import Home from "@/layouts/home/home.vue";
|
import Home from "@/layouts/home/home.vue";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
|
import selectYear from "@/layouts/selectYear/selectYear.vue"
|
||||||
|
import selectMake from "@/layouts/selectMake/selectMake.vue"
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
{
|
{
|
||||||
|
|
@ -16,6 +18,16 @@ const routes = [
|
||||||
Name: "Home",
|
Name: "Home",
|
||||||
component: Home,
|
component: Home,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "/select-year",
|
||||||
|
name: "selectYear",
|
||||||
|
component: selectYear,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/select-make",
|
||||||
|
name: "selectMake",
|
||||||
|
component: selectMake,
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ export default createStore({
|
||||||
mutations: {
|
mutations: {
|
||||||
updateYear(state, data) {
|
updateYear(state, data) {
|
||||||
state.year = data.year;
|
state.year = data.year;
|
||||||
state.makes = data.makes;
|
state.makes = data.makes.data.Result;
|
||||||
state.slideTransition = "slide";
|
state.slideTransition = "slide";
|
||||||
},
|
},
|
||||||
updateMake(state, data) {
|
updateMake(state, data) {
|
||||||
|
|
@ -56,16 +56,7 @@ export default createStore({
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
async selectYear(context, year) {
|
async selectYear(context, year) {
|
||||||
let makes = [];
|
const makes = await axios.get(`https://mockey.qa.sagaws.net/service/makes/year=${year}`);
|
||||||
await globalMethods
|
|
||||||
.callHttpClient({
|
|
||||||
method: "GET",
|
|
||||||
endpoint: `https://mockey.qa.sagaws.net/service/makes/year=${year}`,
|
|
||||||
payload: {},
|
|
||||||
})
|
|
||||||
.then(function (response) {
|
|
||||||
makes = response.data.Result;
|
|
||||||
});
|
|
||||||
context.commit("updateYear", { year, makes });
|
context.commit("updateYear", { year, makes });
|
||||||
router.push(`/select-make?year=${year}`);
|
router.push(`/select-make?year=${year}`);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue