feat: 修复 Mock 路径从 h5-auth-url → h5-auth
This commit is contained in:
@@ -326,25 +326,22 @@ export const authHandlers = [
|
|||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
|
|
||||||
// 6. 获取微信 H5 授权 URL
|
// 6. 获取微信 H5 授权 URL(手机浏览器用)
|
||||||
http.post('/api/auth/wechat/h5-auth-url', async ({ request }) => {
|
http.post('/api/auth/wechat/h5-auth', async ({ request }) => {
|
||||||
await delay(NETWORK_DELAY);
|
await delay(NETWORK_DELAY);
|
||||||
|
|
||||||
const body = await request.json();
|
const body = await request.json();
|
||||||
const { redirect_url } = body;
|
const { redirect_url } = body;
|
||||||
|
|
||||||
const state = generateWechatSessionId();
|
const state = generateWechatSessionId();
|
||||||
const authUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=mock&redirect_uri=${encodeURIComponent(redirect_url)}&response_type=code&scope=snsapi_userinfo&state=${state}#wechat_redirect`;
|
// Mock 模式下直接返回前端回调地址(模拟授权成功)
|
||||||
|
const authUrl = `${redirect_url}?wechat_login=success&state=${state}`;
|
||||||
|
|
||||||
console.log('[Mock] 生成微信 H5 授权 URL:', authUrl);
|
console.log('[Mock] 生成微信 H5 授权 URL:', authUrl);
|
||||||
|
|
||||||
return HttpResponse.json({
|
return HttpResponse.json({
|
||||||
code: 0,
|
auth_url: authUrl,
|
||||||
message: '成功',
|
state
|
||||||
data: {
|
|
||||||
auth_url: authUrl,
|
|
||||||
state
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user