export const getJSON = async (url: string) => { return fetch(url).then( async (res) => { if (!res.ok) { throw { error: res.ok, message: "请求失败", }; } else { const data = await res.json(); if (data.code) { throw data; } else { return data; } } }, (err) => { throw err; } ); };