diff options
Diffstat (limited to 'finished-application/frontend/components/Signout.js')
| -rw-r--r-- | finished-application/frontend/components/Signout.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/finished-application/frontend/components/Signout.js b/finished-application/frontend/components/Signout.js new file mode 100644 index 0000000..ae87631 --- /dev/null +++ b/finished-application/frontend/components/Signout.js @@ -0,0 +1,25 @@ +import React, { Component } from 'react'; +import { Mutation } from 'react-apollo'; +import gql from 'graphql-tag'; +import { CURRENT_USER_QUERY } from './User'; + +const SIGN_OUT_MUTATION = gql` + mutation SIGN_OUT_MUTATION { + signout { + message + } + } +`; + +class Signout extends Component { + render() { + return ( + <Mutation mutation={SIGN_OUT_MUTATION} refetchQueries={[{ query: CURRENT_USER_QUERY }]}> + {signout => <button onClick={signout}>Sign Out</button>} + </Mutation> + ); + } +} + +export default Signout; +export { SIGN_OUT_MUTATION }; |
