Dynamic host

This commit is contained in:
Kilian Hofmann 2021-08-13 14:52:40 +02:00
parent 5166c7d0c5
commit 88439ec273

View File

@ -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]),