-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
example: add apollo-client todo app #147
Conversation
@@ -27,8 +27,8 @@ | |||
"main": "dist/index.cjs.js", | |||
"module": "dist/index.esm.js", | |||
"exports": { | |||
"require": "dist/index.cjs.js", | |||
"default": "dist/index.mjs" | |||
"require": "./dist/index.cjs.js", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Node 12 and VSCode IDE complained about this not being prefixed (could not resolve module), however, bob complained about this being prefixed. I commented the lines out for now. Gotta check whether this is an issue that should be fixed in bob.
1ec8ae2
to
3ba933d
Compare
class SocketIOGraphQLApolloLink extends ApolloLink { | ||
private networkLayer: SocketIOGraphQLClient; | ||
constructor(networkLayer: SocketIOGraphQLClient) { | ||
super() | ||
this.networkLayer = networkLayer; | ||
} | ||
|
||
public request(operation: Operation): Observable<FetchResult> | null { | ||
const sink = this.networkLayer.execute({ | ||
operationName: operation.operationName, | ||
operation: print(operation.query), | ||
variables: operation.variables | ||
}); | ||
|
||
return sink as Observable<FetchResult> | ||
} | ||
} | ||
|
||
export const createApolloClient = ( | ||
networkInterface: SocketIOGraphQLClient | ||
) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the most important part, the glue code between the SocketIOGraphQLClient and ApolloClient :)
Closes #146