In progress sign in changes.
This commit is contained in:
36
client/src/App/App.container.jsx
Normal file
36
client/src/App/App.container.jsx
Normal file
@@ -0,0 +1,36 @@
|
||||
import React from "react";
|
||||
import { Mutation, Query } from "react-apollo";
|
||||
import { gql } from "apollo-boost";
|
||||
|
||||
import App from "./App";
|
||||
|
||||
const SET_CURRENT_USER = gql`
|
||||
mutation SetCurrentUser($user: User!) {
|
||||
setCurrentUser(user: $user) @client
|
||||
}
|
||||
`;
|
||||
|
||||
const GET_CURRENT_USER = gql`
|
||||
{
|
||||
currentUser @client
|
||||
}
|
||||
`;
|
||||
|
||||
const AppContainer = () => (
|
||||
<Query query={GET_CURRENT_USER}>
|
||||
{({ data: { currentUser } }) => (
|
||||
<Mutation mutation={SET_CURRENT_USER}>
|
||||
{setCurrentUser => (
|
||||
<App
|
||||
currentUser={currentUser}
|
||||
setCurrentUser={user => {
|
||||
setCurrentUser({ variables: { user } });
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</Mutation>
|
||||
)}
|
||||
</Query>
|
||||
);
|
||||
|
||||
export default AppContainer;
|
||||
Reference in New Issue
Block a user