
import { upload,list, deleteByid} from "@map/api/cad.js"
const useDistStore = defineStore(
  'cad',
  {
    state: () => ({
      cadList:[],
     }),
    actions:{
      getCadList(fileName){
         list({fileName}).then(res=>{

           this.cadList= res.data
         })
      },
      delectCard(ids){
        deleteByid(ids).then(res=>{
           this.getCadList()
        })
      },
     addCadFile(data){
      return new Promise((resolve, reject) =>{
        upload(data).then(res=>{
          resolve()
          this.getCadList()
        })

      })

     }
    }
  }
)

export default useDistStore
