Full Request URL
diff --git a/src/components/TopicView.jsx b/src/components/TopicView.jsx
index b6afd1d..13661df 100644
--- a/src/components/TopicView.jsx
+++ b/src/components/TopicView.jsx
@@ -2,14 +2,14 @@ import { useEffect, useRef, useState } from 'react'
import EndpointCard from './EndpointCard'
import { getTopicIcon } from '../lib/icons'
-import { LEGACY_BASE_URL } from '../data/topics'
+import { LEGACY_BASE_URL, REST_BASE_URL } from '../data/topics'
+
+const ADMIN_SECRET = 'nearle-admin-secret'
function toProxyPath(fullUrl, baseUrl) {
- // Only proxy the legacy GraphQL API (to inject the admin secret via server)
- if (baseUrl === LEGACY_BASE_URL && fullUrl.startsWith(baseUrl)) {
+ if (fullUrl.startsWith(baseUrl)) {
return fullUrl.slice(baseUrl.length)
}
- // Let the browser hit the new REST API directly (it supports CORS)
return fullUrl
}
@@ -44,9 +44,12 @@ export default function TopicView({ topic, searchQuery }) {
const start = Date.now()
try {
+ const headers = { 'Content-Type': 'application/json' }
+ if (topic.type === 'legacy') headers['x-hasura-admin-secret'] = ADMIN_SECRET
+
const fetchOptions = {
method: endpoint.method,
- headers: { 'Content-Type': 'application/json' },
+ headers,
signal: controller.signal
}
diff --git a/vite.config.js b/vite.config.js
index 812b7d6..51182d8 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -28,14 +28,9 @@ export default defineConfig(({ mode }) => {
}
},
'/live': {
- target: 'https://fiesta.nearle.app',
+ target: 'https://jupiter.nearle.app',
changeOrigin: true,
secure: true,
- configure: (proxy) => {
- proxy.on('proxyReq', (proxyReq) => {
- if (secret) proxyReq.setHeader('x-hasura-admin-secret', secret)
- })
- }
}
}
}