This repository was archived by the owner on Feb 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Networking
Darko Kukovec edited this page Jan 11, 2018
·
3 revisions
To use the network layer, you should check/update the following options:
- Store
baseUrl- The base path to the API. Default is"/", but could be something like"https://example.com/api/" - Record
endpoint- Path to the model type on the API. If not defined, it will use the model type. This can be used if the url needs to be prefixed (e.g. model scoping) or e.g. if the url is in plural, but the model type is in singular -
fetchReference- Set towindow.fetchby default, but can be set to some otherfetchimplementation, e.g.isomorphic-fetch -
defaultHeaders- Headers that will be sent with every request. By default, it is setting thecontent-typeheader according to the JSON API specification
If you want to use some other method of communication with the server (e.g. jQuery, superagent or axios), you can override the baseFetch method.
If you need to set some custom headers which depend on the data in the store, you can override the storeFetch method.
For a detailed specification of the available options, check out the config options.