graphqlfix

This commit is contained in:
2026-05-20 17:20:52 +05:30
parent a5fcb5210c
commit 7bf75d9502

View File

@@ -7,9 +7,12 @@ import { LEGACY_BASE_URL, REST_BASE_URL } from '../data/topics'
const ADMIN_SECRET = 'nearle-admin-secret' const ADMIN_SECRET = 'nearle-admin-secret'
function toProxyPath(fullUrl, baseUrl) { function toProxyPath(fullUrl, baseUrl) {
if (fullUrl.startsWith(baseUrl)) { // REST (jupiter.nearle.app): strip base so /live/... goes through Vite proxy
return fullUrl.slice(baseUrl.length) if (baseUrl === REST_BASE_URL && fullUrl.startsWith(REST_BASE_URL)) {
return fullUrl.slice(REST_BASE_URL.length)
} }
// Legacy (api.workolik.com): CORS is open — fetch the full URL directly.
// Admin secret is injected in the request header, so no proxy needed.
return fullUrl return fullUrl
} }