Ninety-nine Pitchers of Malt
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

team-client-lib

1.0.34 • Public • Published

team-client-lib

module with gqhl queries

1. Installation

You�ll need to have Node >= 6 on your local development machine (but it�s not required on the server).

To add module to you project, run a single command:

 npm install team-client-lib

or if you are using yarn

 yarn add team-client-lib

Create file in your project with content: apiService.js

import mainService from 'team-client-lib';
 import {makeRequest, mutate} from '$CHANGE_PATH';
 

 export const {
     clientService,
     expenseService,
     expenseTypeService,
     leaveService,
     leaveTypeService,
     projectService,
     departmentActions,
     customerService,
     locationService,
     feedService,
     notificationService,
     pricingService,
     labelService,
     taskAssignmentService,
     taskReportTimeService,
     taskService,
     timerService,
     staffService,
     userService
 } = mainService(makeRequest, mutate);

 
 
 

You need to change path to makeRequest and mutate functions, This function must look like:


   const client = new ApolloClient({
       ...
   });
   
   
   export const makeRequest = client.query;
   export const mutate = client.mutate;
   

P.S. you can also add wrapper for you functions, for example:


    export const makeRequest = (queryObject) => {
        //Simple logger
        console.log(queryObject);
       
        return client.query(queryObject)
    }; 
    

###Usage So then you can use this services:


   import {clientService} from './apiService.js'
   
   const getClients = _ => {
       clientService.fetchClients().then(({data, error, errors})=>{
       
       });
   };
   
               
   

Keywords

none

install

npm i team-client-lib

Downloadsweekly downloads

37

version

1.0.34

license

MIT

last publish

collaborators

  • avatar