summaryrefslogtreecommitdiffstats
path: root/frontend/components/Signout.js
blob: ae876310d60c6ad9ea9226e11adec40c6353e3f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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 };