The single point of entry for interacting with the SalesPreso API. Contains functionality for contacting and authorizing wi the API endpoint, as well as middleware, models and collections for sending and retrieving data.
npm install sp-api
or
yarn add sp-api
import {Auth, Api} from "@livepreso/api";
import {registerMiddleware} from "@livepreso/api/middleware";
import AuthMiddleware from "@livepreso/api/middlewares/auth";
import RedirectMiddleware from "@livepreso/api/middlewares/redirect";
const middlewares = [
new AuthMiddleware(),
new RedirectMiddleware(),
new JSONMiddleware()
];
middlewares.map(registerMiddleware);
Api.initialize("http://localhost:8000/api/")
.then(() => {
return Auth.login("yourlogin", "yourpassword");
});