<template>
    <div>
        <baseTemplate
            currentCarInfo="Select a year to get started"
            neededCarInfo="What year is your vehicle?"
            :attritbutes="years"
            :selectAttribute="selectYear"
        />
    </div>
</template>

<script>
import baseTemplate from './BaseTemplate';
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);
      }
  }, 
  components: {
      baseTemplate
  }
}
</script>