mosaicmap/lib/gr-client.ts
2025-08-11 21:26:46 +08:00

14 lines
386 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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`;
}
};