import { gql } from "../helpers/gql";
import { actionPromise } from "./actionsPromise";

export const actionFindUser = (value) => 
    actionPromise('usersList', gql(`query findUser($q: String) {
        UserFind(query: $q) {
          login
          _id
        nick
          avatar {
            _id
            url
          }
        }
      }`,{
          q: JSON.stringify([
              {
                $or : [{nick: `/${value}/`}]
              },
              {
                sort : [{nick: 1}]
              }
          ])
      } ))