fix: 微信 OAuth 配置改走 /wechat/oauth/config 并用 fetch
Some checks are pending
Build and Deploy Front / deploy (push) Waiting to run

避开 /wechat/mp/{appId} 路由冲突,以及 axios Content-Type 触发 OPTIONS 405。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zzh 2026-09-09 12:19:30 +08:00
parent 99088ad461
commit 6788de9016

View File

@ -48,7 +48,10 @@ export async function getFollowQrcode(): Promise<WxFollowQrcodeResult> {
/** H5 网页授权:从其他配置 wechat_mp 读取 AppId / OAuth 回调根 */
export async function getWeChatOAuthConfig(): Promise<WxOAuthConfigResult> {
const res = await axiosInstance.get(omsUrl('/wechat/mp/oauth-config'));
// 不带默认 Content-Type,避免无必要的 CORS 预检(OPTIONS 易被网关/路由判 405)
const res = await axiosInstance.get(omsUrl('/wechat/oauth/config'), {
headers: { 'Content-Type': undefined as unknown as string },
});
const data = unwrapOrSelf<WxOAuthConfigResult & Record<string, unknown>>(res.data);
const appId = String(data.appId ?? data.AppId ?? '').trim();
const oauthRedirectBase = String(