import { GraphQLClient } from "graphql-request"; // 获取基础URL,兼容服务端和客户端 export const getBaseUrl = () => { if (typeof window !== 'undefined') { // 客户端:使用相对路径 return '/api/bff'; } else { // 服务端:使用完整URL return `${process.env.NEXTAUTH_URL || 'http://localhost:3000'}/api/bff`; } };