import gql from 'graphql-tag';
import { graphql } from 'react-apollo';

export const MUTATION = gql`
  mutation registerUser($email: String!, $password: String!, $firstName: String!, $lastName: String!) {
    registerUser(email: $email, password: $password, firstName: $firstName, lastName: $lastName) {
      id
    }
  }
`;

export default graphql(MUTATION, {
  props: ({ mutate }) => ({
    register: (params = {}) => {
      const {
        email,
        password,
        firstName,
        lastName,
      } = params;

      return mutate({
        variables: {
          email,
          password,
          firstName,
          lastName,
        },
      });
    },
  }),
});

@@ -63,16 +63,94 @@
 apollo';
+%0Aimport get from 'lodash/get';%0Aimport %7B%0A  AsyncStorage,%0A%7D from 'react-native';
 %0A%0Aexport
@@ -384,16 +384,28 @@
      id%0A
+      token%0A
     %7D%0A  
@@ -486,16 +486,22 @@
 egister:
+ async
  (params
@@ -512,16 +512,30 @@
 %7D) =%3E %7B%0A
+      try %7B%0A  
       co
@@ -540,39 +540,43 @@
 const %7B%0A        
+ 
+ 
 email,%0A
+  
         password
@@ -577,32 +577,34 @@
 ssword,%0A        
+  
 firstName,%0A     
@@ -598,32 +598,34 @@
 stName,%0A        
+ 
+ 
 lastName,%0A      
@@ -614,24 +614,26 @@
   lastName,%0A
+  
       %7D = pa
@@ -649,14 +649,25 @@
     
-return
+  const r = await
  mut
@@ -672,16 +672,18 @@
 utate(%7B%0A
+  
         
@@ -697,32 +697,34 @@
 es: %7B%0A          
+  
 email,%0A         
@@ -716,32 +716,34 @@
 mail,%0A          
+ 
+ 
 password,%0A      
@@ -728,32 +728,34 @@
       password,%0A
+  
           firstN
@@ -761,32 +761,34 @@
 Name,%0A          
+  
 lastName,%0A      
@@ -773,32 +773,34 @@
       lastName,%0A
+  
         %7D,%0A     
@@ -800,20 +800,173 @@
 ,%0A      
+  
 %7D);%0A
+        await AsyncStorage.setItem('authToken', get(r, 'data.registerUser.token'));%0A        return r;%0A      %7D catch (err) %7B%0A        throw err;%0A      %7D%0A
     %7D,%0A 

Patch registerUser flow