0
点赞
收藏
分享

微信扫一扫

前端hook项目pc总结笔记-postgrest方法拼接扩展

http://xxxxxx/search_manufacture_cutting?manufacture_id=eq.167&is_delete=eq.0
&institution_id=eq.1
&materiel_id=eq.2482

前端hook项目pc总结笔记-postgrest方法拼接扩展_vue.js


getOne: (resource: any, params: any,data?:any) => {
console.log(data,params,"paramsparamsparams")
// var test=data
const key: any = Object.keys(params)
// params.institution_id=``
const id = params[key[0]];
const primaryKey = getPrimaryKey(resource, primaryKeys);
const query = getQuery(primaryKey, id, resource);
//转换id
var url = `${PostgrestUrl}/${resource}?
${query.replace("id", key[0])}&is_delete=eq.0&institution_id=eq.
${localStorage.getItem("instId")}`;
if(data!=null&&data!=undefined&&data!=''){
url+=`&materiel_id=eq.${data}`
}
return httpClient(url, {
headers: new Headers({}),
}).then(({ json }) => ({
data: dataWithId(json, primaryKey),
})).catch((err) => {
return err
})
},



举报

相关推荐

0 条评论