2017-06-30 22:18:11 +02:00
|
|
|
import gql from 'graphql-tag'
|
|
|
|
|
2018-12-17 17:34:32 +01:00
|
|
|
export default apolloClient =>
|
|
|
|
apolloClient
|
|
|
|
.query({
|
|
|
|
query: gql`
|
|
|
|
query getUser {
|
|
|
|
user {
|
|
|
|
id
|
|
|
|
name
|
|
|
|
}
|
2017-06-30 22:18:11 +02:00
|
|
|
}
|
2018-12-17 17:34:32 +01:00
|
|
|
`
|
|
|
|
})
|
|
|
|
.then(({ data }) => {
|
|
|
|
return { loggedInUser: data }
|
|
|
|
})
|
|
|
|
.catch(() => {
|
|
|
|
// Fail gracefully
|
|
|
|
return { loggedInUser: {} }
|
|
|
|
})
|