import {actionPromise, gql} from "./index";


const actionUserUpdate = (data) => {

    return async dispatch => {
        const queryJson = JSON.stringify(
            {
                user: data
            }
        )
        await dispatch(actionPromise('newUser', gql(
            `mutation updateMe($user:UserInput){
                UserUpsert(user: $user){
                  _id
                  nick
                  login
                  avatar{
                  url
                  }
                }
              }`, queryJson
        )))
    }

}

export default actionUserUpdate;