From 88439ec273073015c459903e5b56d56cfc145a7f Mon Sep 17 00:00:00 2001 From: Kilian Hofmann Date: Fri, 13 Aug 2021 14:52:40 +0200 Subject: [PATCH] Dynamic host --- src/App.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 03446a2..2577536 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -26,9 +26,11 @@ const App = (): React.ReactElement => { modifiers: ['sidebarExtended'], }; + const host = window.location.hostname; + const echoClient = new Echo({ broadcaster: 'socket.io', - host: 'http://localhost:6001', + host: `http://${host}:6001`, client: io, auth: { headers: { @@ -37,7 +39,7 @@ const App = (): React.ReactElement => { }, }); const echoLink = new EchoLink(echoClient); - const httpLink = new HttpLink({ uri: 'http://localhost/graphql/' }); + const httpLink = new HttpLink({ uri: `http://${host}/graphql/` }); const client = new ApolloClient({ link: ApolloLink.from([echoLink, httpLink]),