update pay function
This commit is contained in:
@@ -138,11 +138,12 @@ export default function MCPChat() {
|
||||
}
|
||||
|
||||
if (!isAuthenticated) {
|
||||
const mainAppUrl = process.env.NEXT_PUBLIC_MAIN_APP_URL || 'https://valuefrontier.cn';
|
||||
return (
|
||||
<div className="flex flex-col items-center justify-center h-screen">
|
||||
<h2 className="text-2xl mb-4">请先登录</h2>
|
||||
<a
|
||||
href={`${process.env.NEXT_PUBLIC_MAIN_APP_URL}/auth/sign-in?redirect=/chat`}
|
||||
href={`${mainAppUrl}/auth/sign-in?redirect=/ai-chat`}
|
||||
className="bg-blue-600 text-white px-6 py-2 rounded hover:bg-blue-700"
|
||||
>
|
||||
前往登录
|
||||
|
||||
@@ -22,8 +22,12 @@ export interface AuthInfo {
|
||||
*/
|
||||
export async function checkAuth(): Promise<AuthInfo> {
|
||||
try {
|
||||
// 使用硬编码的 URL 作为后备
|
||||
const apiUrl = process.env.NEXT_PUBLIC_API_URL || 'http://49.232.185.254:5001';
|
||||
console.log('API URL:', apiUrl); // 调试日志
|
||||
|
||||
// 调用主应用的 session 检查接口
|
||||
const response = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/api/auth/session`, {
|
||||
const response = await fetch(`${apiUrl}/api/auth/session`, {
|
||||
credentials: 'include', // 重要:携带 Cookie
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
||||
Reference in New Issue
Block a user