diff --git a/src/app/api/zeus/index.ts b/src/app/api/zeus/index.ts index 8d8ac97..6087b97 100644 --- a/src/app/api/zeus/index.ts +++ b/src/app/api/zeus/index.ts @@ -7,14 +7,18 @@ export const HOST = "http://localhost:8080/v1/graphql" export const HEADERS = {} -import { createClient, type Sink } from 'graphql-ws'; // keep +import { createClient, type Sink } from 'graphql-ws'; export const apiSubscription = (options: chainOptions) => { - - // const headers : Record = {}; + + const h = options[1]?.headers; + // const passedHeaders : HeadersInit = /*options[1]?.headers ??*/ new Headers(); + // const h = {'authorization':passedHeaders['authorization'] ?? '','x-hasura-role':passedHeaders['x-hasura-role'] ?? ''}; + // const empty : [string, string][] = []; + // const headers : HeadersInit = passedHeaders ? passedHeaders : empty; const client = createClient({ url: String(options[0]), - // connectionParams: Object.fromEntries(new Headers(options[1]?.headers).entries()), + connectionParams: h ? Object.fromEntries(new Headers(h).entries()) : undefined, }); const ws = new Proxy(