Server: AuthID passed from decoded token via context

This commit is contained in:
Barry Low committed 2018-09-10 22:13:10 -07:00
1 parent 0669921d0e
commit 12e055ee80
6 files changed
+29 -29

No files matched your search

+1 -1
View File
@@ -34,7 +34,7 @@ const errorLink= onError(({ graphQLErrors, networkError }) => {
graphQLErrors.map(({ message, locations, path }) =>
console.log(
`[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}`,
),
)
);
if (networkError) console.log(`[Network error]: ${networkError}`);
})
+1 -9
View File
@@ -52,12 +52,4 @@ class LoggedInUser extends Component {
}
}
export default graphql(getUserByAuthIdQuery, { // What follows is the way to pass a parameter to a query.
options: (props) => {
return {
variables: {
authId: props.authId
}
}
}
})(LoggedInUser); // This binds the querty to the component
export default graphql(getUserByAuthIdQuery)(LoggedInUser); // This binds the querty to the component
+1 -1
View File
@@ -53,7 +53,7 @@ class NavBar extends Component {
const userStored = localStorage.getItem('user');
if (userStored !== null && userStored !== undefined && userStored !== 'undefined') {
const user = JSON.parse(userStored);
const user = userStored;
/* For some reason, the result of GraphQL some times varies, that is why I had to do the following hack. */
+2 -2
View File
@@ -35,8 +35,8 @@ query($id: ID){
`
const getUserByAuthIdQuery = gql`
query($authId: String){
userByAuthId (authId: $authId){
query {
userByAuthId{
id
alias
firstName