import { defineStore } from "pinia";
import { ref } from "vue";

export const useStore = defineStore("useStore",()=> {
        let formData = ref({
            articleId: "",
            companyName: "",
            companyIntro: "",
            contactPerson: "",
            contactPhone: "",
            positionList: []
        })
      function setFormDataKey(key, data) {
        console.log('keykeykey',key,data);
        
            formData.value[key] = data;
        }
        
        function resetForm() {
            formData.value.articleId=""
            formData.value.companyName=""
            formData.value.companyIntro=""
            formData.value.contactPerson=""
            formData.value.contactPhone=""
            formData.value.positionList=[]
        }
        return {
            formData,
            setFormDataKey,
            resetForm
        }
});
