Merge branch 'new-CounterFire' of http://git.kingsome.cn/huangjinming/CounterFireGames into new-CounterFire

This commit is contained in:
yuyongdong 2024-06-24 13:29:54 +08:00
commit 339e062b86

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'); const token = localStorage.getItem('assessToken');
let headers = {"Content-Type": "application/json"}; let headers = {"Content-Type": "application/json"};
if (token) { if (token) {
headers['Authorization'] = `Bearer ${token}`; headers['Authorization'] = `Bearer ${token}`;
} }
url = url + (url.indexOf('?') > -1 ? "&" : "?" )+ new URLSearchParams(data).toString()
return fetch(url, { return fetch(url, {
method: "GET", method: "GET",
headers headers
@ -43,14 +44,14 @@ export const apiMarketplaceState = async (data) => {
// 获取我拥有得资产 // 获取我拥有得资产
export const apiAssetsState = async (account_address, data) => { export const apiAssetsState = async (account_address, data) => {
const url = `${API_BASE}/api/asset/${net_id}/${account_address}?type=${data.type}?ge_size=${data.page_size}?cursor=${data.cursor}?search_name=${data.search_name}` const url = `/api/asset/${net_id}/${account_address}`
return httpGet(url, {}) return httpGet(url, data)
} }
// 获取上架出售得NFTS // 获取上架出售得NFTS
export const apiHangingState = async (account_address, data) => { export const apiHangingState = async (account_address, data) => {
const url = `${API_BASE}/api/asset/${net_id}/${account_address}` const url = `/api/asset/${net_id}/${account_address}`
return httpGet(url, {data}) return httpGet(url, data)
} }
// 账号交易历史 // 账号交易历史
@ -74,7 +75,7 @@ export const apiGetCartList = async () => {
// 添加购物车 // 添加购物车
export const apiAddCartList = async (data) => { export const apiAddCartList = async (data) => {
const url = `${API_BASE}/api/shopcart/add` const url = `${API_BASE}/api/shopcart/add`
return httpPost(url, {data}) return httpPost(url, data)
} }
// 删除购物车 // 删除购物车