Skip to content
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

Merged
merged 2 commits into from
Oct 10, 2020
Merged

Conversation

n1ru4l
Copy link
Owner

@n1ru4l n1ru4l commented Oct 8, 2020

Closes #146

@n1ru4l n1ru4l changed the title feat: add apollo-client todo app example: add apollo-client todo app Oct 8, 2020
@@ -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",
Copy link
Owner Author

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.

@n1ru4l n1ru4l force-pushed the feat-apollo-client-todo-example branch from 1ec8ae2 to 3ba933d Compare October 8, 2020 20:37
Comment on lines +6 to +26
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
) => {
Copy link
Owner Author

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 :)

@n1ru4l n1ru4l merged commit 853af4e into main Oct 10, 2020
@n1ru4l n1ru4l deleted the feat-apollo-client-todo-example branch October 10, 2020 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add todo example app with apollo
1 participant