<script setup>
    import { onMounted, ref } from 'vue';
    import { useCompanyStore } from '../stores/company';
    import Spiner from '../components/ui/Spiner.vue';
    import CardProposal from '../components/CardProposal.vue';

    const companyStore = useCompanyStore();
    const loading = ref(false);

    onMounted(() =>{
        getInitData();
    })

    const getInitData = async() => {
        loading.value = true;
        await companyStore.getProposalsCompany();
        loading.value = false;
    }
</script>

<template>
    <div>
        <h2 class="title mb-5">Mis vehiculos publicadas</h2>
        <Spiner v-if="loading"/>
        <CardProposal 
            v-else
            v-for="proposal in companyStore.proposals"
            :key="proposal._id"
            :proposal="proposal" 
        />
    </div>
</template>

<style scoped>

</style>