feature/Reynolds-and-Reynolds-DMS-API-Integration - Use current Token

This commit is contained in:
Dave
2025-10-01 14:22:18 -04:00
parent b995e1f35d
commit d95c5ce8f9

View File

@@ -172,8 +172,11 @@ async function RRSelectedCustomer({ socket, redisHelpers, selectedCustomerId, jo
// --- GraphQL job fetch
async function QueryJobData({ socket, jobid }) {
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {});
const currentToken =
(socket?.data && socket.data.authToken) || (socket?.handshake?.auth && socket.handshake.auth.token);
const result = await client
.setHeaders({ Authorization: `Bearer ${socket.handshake?.auth?.token}` })
.setHeaders({ Authorization: `Bearer ${currentToken}` })
.request(queries.QUERY_JOBS_FOR_CDK_EXPORT, { id: jobid });
return result.jobs_by_pk;
}