The Config File
Where we discuss the config file, the place where all the magic happens!
Anatomy of a config file
Redux-optimum takes full advantage of the Redux philosophy. It is an add-on. Thus, you will proceed with your reducers any normal way you would. The config file just allows to define what gets call as actions during an API call and to set up some API specific patterns of behavior. First, let's divide up in three parts our config object.
First are the generic options for the config file. All of these come with default values and are at the root of the object.
needsToBeLoggedIn: boolean
sendsAccessToken: string
mode: string
HTTPCodesRefreshToken: <int>array
HTTPCodeFailures: <int>array
retriesDelays: <int>array or int
clearAfterAllRetriesFailed: boolean
Second are the credential management parameters. They sit under the property credentialManagement at the root of the object.
loggedInSelector: (store) => boolean
getAccessToken: (store) => ({key: value})
getRefreshToken: (store) => ({key: value})
refreshingTokenCallDetails: {
endpoint: (store) => string,
method: string,
HTTPCodeFailures: <int>Array,
retriesDelays: <int>Array or int
sendRefreshToken: string
requestParameters: object,
})
uponReceivingFreshToken: (answerbody) => {}
Third are the actual operations. They sit under the property operations at the root of the object.
operations: <operation>array
Last updated
Was this helpful?