mirror of
https://github.com/vale981/Vulcan
synced 2025-03-09 04:16:37 -04:00
30 lines
648 B
JavaScript
30 lines
648 B
JavaScript
import React, { Component } from 'react';
|
|
import { getFragment } from 'meteor/vulcan:lib';
|
|
import { graphql } from 'react-apollo';
|
|
import gql from 'graphql-tag';
|
|
|
|
const withCurrentUser = component => {
|
|
|
|
return graphql(
|
|
gql`
|
|
query getCurrentUser {
|
|
currentUser {
|
|
...UsersCurrent
|
|
}
|
|
}
|
|
${getFragment('UsersCurrent')}
|
|
`, {
|
|
alias: 'withCurrentUser',
|
|
|
|
props(props) {
|
|
const {data: {loading, currentUser}} = props;
|
|
return {
|
|
currentUserLoading: loading,
|
|
currentUser,
|
|
};
|
|
},
|
|
}
|
|
)(component);
|
|
}
|
|
|
|
export default withCurrentUser;
|