2016-12-21 12:04:43 +01:00
|
|
|
import React, { Component } from 'react';
|
2017-03-23 16:27:59 +09:00
|
|
|
import { getFragment } from 'meteor/vulcan:lib';
|
2016-12-21 12:04:43 +01:00
|
|
|
import { graphql } from 'react-apollo';
|
|
|
|
import gql from 'graphql-tag';
|
2016-11-30 16:58:28 +09:00
|
|
|
|
2017-01-23 11:00:44 +09:00
|
|
|
const withCurrentUser = component => {
|
2017-01-12 17:30:25 +09:00
|
|
|
|
2017-02-28 11:49:40 +01:00
|
|
|
return graphql(
|
|
|
|
gql`
|
|
|
|
query getCurrentUser {
|
|
|
|
currentUser {
|
|
|
|
...UsersCurrent
|
|
|
|
}
|
2017-01-12 17:30:25 +09:00
|
|
|
}
|
2017-02-28 11:49:40 +01:00
|
|
|
${getFragment('UsersCurrent')}
|
2017-01-12 17:30:25 +09:00
|
|
|
`, {
|
2017-01-14 08:29:51 +09:00
|
|
|
alias: 'withCurrentUser',
|
|
|
|
|
2017-01-12 17:30:25 +09:00
|
|
|
props(props) {
|
|
|
|
const {data: {loading, currentUser}} = props;
|
|
|
|
return {
|
2017-04-03 16:06:57 +09:00
|
|
|
currentUserLoading: loading,
|
2017-01-12 17:30:25 +09:00
|
|
|
currentUser,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
}
|
|
|
|
)(component);
|
|
|
|
}
|
|
|
|
|
2017-01-23 11:00:44 +09:00
|
|
|
export default withCurrentUser;
|