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 <noreply@anthropic.com>
This commit is contained in:
parent
d6449d8b52
commit
6dc5df45e5
1 changed files with 1 additions and 1 deletions
|
|
@ -161,7 +161,7 @@ export async function integrationRoutes(app) {
|
||||||
try {
|
try {
|
||||||
if (!creds.graphql_endpoint || !creds.graphql_username || !creds.graphql_password || !creds.graphql_client_id)
|
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')
|
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`, {
|
const tokenRes = await fetch(`${base}/Token`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue