Fetch dictionary data using a custom REST data fetcher
The RestDictionaryServiceConfig type accepts a dataFetcher property. You can use this property to pass a custom data fetcher to your instance of the Dictionary Service. By default, the JSS REST Dictionary service uses the NativeDataFetcher.
This example assumes you create the files in the root directory of the application and that you have a config.js file in that same directory. Adjust the import statements as necessary to reflect your project's setup.
To use a REST dictionary service with a custom data fetcher:
-
In a
dictionary-service.tsfile, create an instance of theRestDictionaryServiceclass and provide the configuration object:-
For JSS version 22.4 or later, use
NativeDataFetcher: -
For JSS version 22.3 or earlier, use
AxiosDataFetcher:
-
-
Import and use the new dictionary service: