import Api from "~/service/Api"

const prefix = "gjjs/business"
const cache = {}

function viewAllTrans(){
    return Api.pget(`/${prefix}/model/view/all`)    
}

async function viewModelData(trans){
    if(cache.trans){
        return new Promise(resolve=>resolve(cache.trans))
    }
    let rtndata = Api.pget(`/${prefix}/model/view/${trans}`)
    if(rtndata.respCode == SUCCESS){
        cache[trans] = rtndata
    }
    return rtndata   
}

export default {viewAllTrans,viewModelData}