Tutorial

For example you can use this files structure.

├── src/  
|   ├── reducers  
|   |   ├── products-reducer.js  
|   ├── containers  
|   |   ├── ProductsContainer.js  
|   ├── pages  
|   |   ├── Products.js
|   ├── services  
|   |   ├── api
|    |    |    ├── ProductsAPI.js
└── App.js

App.js The first you need initialize global settings, add this into your app.js file

import RESTService from 'rest-redux-actions';

RESTService.init({  
  headers: {}, // Your App headers here default {'Accept': 'application/json', 'Content-Type': 'application/json'}
  baseUrl: '', // Your App base url here
  apiUrl: '', //  Your App API url here
  applicationId: 'APP_ID', // Your App application id name (optional), default null,
  fetchTimeOut: 60 * 1000, // Request time out default 1m
  timeOutMessage: 'Request timed out',
  token: '' // The authentification token name
});

For save token you can use this static method

ProductsAPI.js

products-reducer.js

ProductsContainer.js

Products.js

Last updated