/* 由 static/js/{navigation,share,subscribe,map}.js 逐块搬运而来;正文与原实现一致。 */ import { S } from "./state"; import { fetchWithTimeout } from "./fetch"; // static/js/share.js:6-17 export function shareApi(url: string, method?: string, body?: any) { const opts: any = { method: method || "GET", headers: {} }; if (S.authToken) opts.headers["Authorization"] = `Bearer ${S.authToken}`; if (body !== undefined) { opts.headers["Content-Type"] = "application/json"; opts.body = JSON.stringify(body); } return fetchWithTimeout(url, opts).then(r => r.json()); } // ===== 私密备注(昵称) 工具 ===== // 显示对方时:优先用“我给他起的备注(昵称)”,其次显示名,最后退回邮箱