monday-api-client
Version:
Easy to use client for talking to the Monday.com API.
24 lines (21 loc) • 603 B
JavaScript
const mondaySdk = require('monday-sdk-js'),
monday = mondaySdk(),
graphQlUser = require('../graphQL/userQuery');
export const user = {
getBasicData : (userId, token, cb) => {
const query = graphQlUser.createGetQuery(userId);
apiCall(query, token, cb);
},
getAll : (token, cb) => {
const query = graphQlUser.createGetAllQuery();
apiCall(query, token, cb);
}
}
const apiCall = (query, token, cb) => {
monday.setToken(token);
monday.api(query).then(res => {
cb(res);
}).catch(error => {
cb(`Error: ${error}`);
});
}