import graphql from '../utils/graphql' ; const fn = ( api ) => { return ( { args = { } , fields = `success` } ) => { return ( dispatch , getState ) => { return new Promise ( async ( resolve ) => { let accessToken = getState ( ) . user . accessToken ; let [ err , res ] = await graphql ( { type : 'mutation' , apis : [ { api , args , fields } ] , headers : accessToken ? { 'accessToken' : accessToken } : { } } ) ; if ( err ) { resolve ( [ err ] ) ; } else { resolve ( [ null , res ] ) ; } } ) ; } ; } ; } ; export const addPhone = fn ( 'addPhone' ) ;