From 2aed25f46387dc31bbe7e42255c5155cf28b586b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilse=20=C3=85sbakk=20Resell?= Date: Fri, 16 Oct 2026 20:46:46 +0200 Subject: [PATCH] fix: add default address to dev to fix bug from prev PR Dev: the local backend. Production build: Apache forwards /project2/graphql to the backend on the VM. client.ts automatically sets default address based on context to avoid trying to access unavailable address --- client/src/apollo/client.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/client/src/apollo/client.ts b/client/src/apollo/client.ts index c798687..386a4a9 100644 --- a/client/src/apollo/client.ts +++ b/client/src/apollo/client.ts @@ -1,7 +1,10 @@ import { ApolloClient, HttpLink, InMemoryCache } from '@apollo/client'; -// GraphQL server address. Override with VITE_GRAPHQL_URL in .env (e.g. on the VM) -const uri = import.meta.env.VITE_GRAPHQL_URL ?? '/project2/graphql';; +// GraphQL server address. Override with VITE_GRAPHQL_URL in .env if needed. +// Dev: the local backend. Production build: Apache forwards /project2/graphql to the backend on the VM. +const uri = + import.meta.env.VITE_GRAPHQL_URL ?? + (import.meta.env.DEV ? 'http://localhost:3001/graphql' : '/project2/graphql'); export const client = new ApolloClient({ link: new HttpLink({ uri }), // how requests reach the server