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