Skip to content

Commit

Permalink
Updates on documentation and fixing userDefaultFields
Browse files Browse the repository at this point in the history
  • Loading branch information
theodorDiaconu committed Aug 29, 2018
1 parent c6e0165 commit 74d90fd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/accounts.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { initialize } from 'meteor/cultofcoders:apollo';
initialize({}, {
// You can configure your default fields to fetch on GraphQL request
// This works with Subscription onConnect()
userDefaultFields: {
userFields: {
_id: 1,
roles: 1,
}
Expand Down
2 changes: 1 addition & 1 deletion package.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package.describe({
name: 'cultofcoders:apollo',
version: '0.7.2',
version: '0.7.3',
// Brief, one-line summary of the package.
summary: 'Meteor & Apollo integration',
// URL to the Git repository containing the source code for this package.
Expand Down
13 changes: 3 additions & 10 deletions server/initialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function initialize(apolloConfig = {}, meteorApolloConfig = {}) {
{
gui: Meteor.isDevelopment,
middlewares: [],
userFields: {
userDefaultFields: {
_id: 1,
roles: 1,
username: 1,
Expand Down Expand Up @@ -72,10 +72,6 @@ export default function initialize(apolloConfig = {}, meteorApolloConfig = {}) {
res.end();
}
});

return {
server,
};
}

function getContextCreator(meteorApolloConfig, defaultContextResolver) {
Expand All @@ -94,13 +90,10 @@ function getContextCreator(meteorApolloConfig, defaultContextResolver) {
} else {
let userContext = {};
if (Package['accounts-base']) {
const loginToken =
req.headers['meteor-login-token'] ||
req.cookies['meteor-login-token'];

const loginToken = req.headers['meteor-login-token'];
userContext = await getUserForContext(
loginToken,
meteorApolloConfig.userDefaultFields
meteorApolloConfig.userFields
);
}

Expand Down

0 comments on commit 74d90fd

Please sign in to comment.