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

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

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
})
},

posted @   前端导师歌谣  阅读(12)  评论(0编辑  收藏  举报  
相关博文:
阅读排行:
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 零经验选手,Compose 一天开发一款小游戏!
· 一起来玩mcp_server_sqlite,让AI帮你做增删改查!!
点击右上角即可分享
微信分享提示