This library helps abstracting the CRUD operations on aa Api resource.
npm install pyntax-data-framework --saveAPPLICATION_NAME: 'APPLICATION_NAME'
BASE_URL: 'BASE_URL'
API_URL: 'BASE_API_URI'
UNAUTHENTICATED_REDIRECT_ROUTE: 'UNAUTHENTICATED_REDIRECT_ROUTE'- Import the make function from the library, it's the factory function.
import {make} from 'pyntax-data-framework/lib/data/ResourceManagerFactory';
import ResourceUrls from 'pyntax-data-framework/lib/data/ResourceUrls';
const ContactApi = make(new ResourceUrls("contact"));ContactApi.create({first_name: "Sahil", last_name: "Sharma"}).then((res) => {
console.log(res);
}).catch((err) => {
console.error(err);
})ContactApi.update(id,{first_name: "Sahil", last_name: "Sharma"}).then((res) => {
console.log(res);
}).catch((err) => {
console.error(err);
});ContactApi.update(id,{first_name: "Sahil", last_name: "Sharma"}).then((res) => {
console.log(res);
}).catch((err) => {
console.error(err);
});ContactApi.getById(id).then((res) => {
console.log(res);
}).catch((err) => {
console.error(err);
});ContactApi.findAll(pageSize, pageNumber, additionalParameters).then((res) => {
console.log(res);
}).catch((err) => {
console.error(err);
});