You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So i've set up my react project with Apollo & React, just after the book, i've followed the examples shown in the README. But i still can't get it to function, it does seem to connect to my Phoenix socket. but when ever i fire of a query it will simply send a post request instead.
import { AppContainer } from "react-hot-loader";
import React from "react";
import ReactDOM from "react-dom";
import { InMemoryCache } from "apollo-cache-inmemory";
import { ApolloProvider } from "react-apollo";
import ApolloClient from "apollo-boost";
// import { ApolloLink } from "apollo-link";
import { createStore, applyMiddleware, combineReducers } from "redux";
import { Provider } from "react-redux";
import thunk from "redux-thunk";
import { ConnectedRouter, routerMiddleware } from "react-router-redux";
import createHistory from "history/createBrowserHistory";
import * as AbsintheSocket from "@absinthe/socket";
import { createAbsintheSocketLink } from "@absinthe/socket-apollo-link";
import { Socket as PhoenixSocket } from "phoenix";
import reducers from "./js/reducers";
import Application from "./js/Application";
// import "../scss/main.scss";
import absintheSocketLink from "./socketLink";
const history = createHistory();
const appRouterMiddleware = routerMiddleware(history);
const client = new ApolloClient({
link: absintheSocketLink,
cache: new InMemoryCache(),
});
const store = createStore(
combineReducers(reducers),
{},
applyMiddleware(appRouterMiddleware, thunk)
);
const render = Component => {
ReactDOM.render(
<AppContainer>
<Provider store={ store }>
<ApolloProvider client={ client }>
<ConnectedRouter history={ history }>
<Component />
</ConnectedRouter>
</ApolloProvider>
</Provider>
</AppContainer>,
document.getElementById("root")
);
};
I stripped some unrelated code, for simplicity.
absintheSocketLink is basically the first example shown. As mentioned this does connect to my socket, but it send my queries to http://localhost:8080/graphql - which i guess is some sort of a fallback.
Is anyone experiencing anything similar? Or am i doing something completely wrong.
The text was updated successfully, but these errors were encountered:
So i've set up my react project with Apollo & React, just after the book, i've followed the examples shown in the README. But i still can't get it to function, it does seem to connect to my Phoenix socket. but when ever i fire of a query it will simply send a post request instead.
This is my deps.
And my setup.
I stripped some unrelated code, for simplicity.
absintheSocketLink is basically the first example shown. As mentioned this does connect to my socket, but it send my queries to http://localhost:8080/graphql - which i guess is some sort of a fallback.
Is anyone experiencing anything similar? Or am i doing something completely wrong.
The text was updated successfully, but these errors were encountered: