const fetchGetParams = { method: "GET", headers: { "PRIVATE-TOKEN": "Zd1UASPcMwVox5tNS6ep" }, } /** * 获取项目详情 * @param id 项目id */ const fetchTemplate = async (id: number) => { try { const response = await fetch( `https://git.n.xiaomi.com/api/v4/projects/${id}`, fetchGetParams ) const body = (await response.json()) as any if (body.message === "404 Project Not Found") return null return body } catch { return null } } const service = { fetchTemplate, } export default service