UNPKG

585 BJavaScriptView Raw
1import { useContext } from 'react';
2import { useMutation } from 'react-apollo';
3import { login } from '@jetshop/core/data/mutations/accountMutations.gql';
4import AuthContext from '../components/AuthContext/AuthContext';
5const useLoginMutation = () => {
6 const { updateLoggedIn } = useContext(AuthContext);
7 const [loginMutation] = useMutation(login, {
8 onCompleted: data => {
9 updateLoggedIn(!!data.login.token, data.login.token.value);
10 }
11 });
12 return { loginMutation };
13};
14export { useLoginMutation };
15//# sourceMappingURL=useLoginMutation.js.map
\No newline at end of file