From da42d8ee1d4df90ba839f7106e72ec6eca0ca0fa Mon Sep 17 00:00:00 2001 From: GalvinGao Date: Wed, 23 Aug 2023 22:28:49 -0400 Subject: [PATCH] fix: endpoint --- src/main.tsx | 2 +- src/services/relay.ts | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/main.tsx b/src/main.tsx index e5e72dc..49f71fe 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -10,7 +10,7 @@ Sentry.init({ integrations: [ new Sentry.BrowserTracing({ // Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled - tracePropagationTargets: ["localhost", "https:penguin-stats.io"], + tracePropagationTargets: ["localhost", "https://rogue.penguin-stats.io"], }), new Sentry.Replay(), ], diff --git a/src/services/relay.ts b/src/services/relay.ts index e67b858..bca6767 100644 --- a/src/services/relay.ts +++ b/src/services/relay.ts @@ -9,17 +9,20 @@ import { getToken, setToken } from "../utils/storage" const fetchRelay: FetchFunction = async (params, variables) => { console.debug("Relay request", params, variables) - const response = await fetch("http://localhost:3500/graphql", { - method: "POST", - headers: { - "content-type": "application/json", - ...(getToken() && { authorization: `Bearer ${getToken()}` }), + const response = await fetch( + (import.meta.env.VITE_API_URL || "") + "/graphql", + { + method: "POST", + headers: { + "content-type": "application/json", + ...(getToken() && { authorization: `Bearer ${getToken()}` }), + }, + body: JSON.stringify({ + query: params.text, + variables, + }), }, - body: JSON.stringify({ - query: params.text, - variables, - }), - }) + ) const newToken = response.headers.get("x-penguin-roguestats-set-token") if (newToken) setToken(newToken)