From 6dc5df45e5cb617be983e9125d7dda8f2e2b6e70 Mon Sep 17 00:00:00 2001 From: jtricerolph Date: Tue, 14 Jul 2026 13:45:52 +0000 Subject: [PATCH] Fix SambaPOS GraphQL token URL: derive from origin so /api/graphql suffix in endpoint field doesn't break it Co-Authored-By: Claude Sonnet 4.6 --- src/routes/integrations.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/integrations.js b/src/routes/integrations.js index 47a316a..f1381a7 100644 --- a/src/routes/integrations.js +++ b/src/routes/integrations.js @@ -161,7 +161,7 @@ export async function integrationRoutes(app) { try { if (!creds.graphql_endpoint || !creds.graphql_username || !creds.graphql_password || !creds.graphql_client_id) throw new Error('GraphQL endpoint, username, password and client ID are required') - const base = creds.graphql_endpoint.replace(/\/$/, '') + const base = new URL(creds.graphql_endpoint).origin const tokenRes = await fetch(`${base}/Token`, { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' },