修正get请求忽略参数的bug的

This commit is contained in:
CounterFire2023 2024-06-24 13:26:07 +08:00
parent a474382f31
commit 14d8563995

View File

@ -21,12 +21,13 @@ const httpPost = async (url, data) => {
}
const httpGet = async (url) => {
const httpGet = async (url, data) => {
const token = localStorage.getItem('assessToken');
let headers = {"Content-Type": "application/json"};
if (token) {
headers['Authorization'] = `Bearer ${token}`;
}
url = url + (url.indexOf('?') > -1 ? "&" : "?" )+ new URLSearchParams(data).toString()
return fetch(url, {
method: "GET",
headers
@ -44,13 +45,13 @@ export const apiMarketplaceState = async (data) => {
// 获取我拥有得资产
export const apiAssetsState = async (account_address, data) => {
const url = `/api/asset/${net_id}/${account_address}`
return httpGet(url, {data})
return httpGet(url, data)
}
// 获取上架出售得NFTS
export const apiHangingState = async (account_address, data) => {
const url = `/api/asset/${net_id}/${account_address}`
return httpGet(url, {data})
return httpGet(url, data)
}
// 账号交易历史