Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

searchApi: configure axios interceptors #86

Merged
merged 2 commits into from
Dec 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Changes

Version 0.16.0 (released 2019-12-04)
* added configuration for passing axios interceptors in `InvenioSearchApi`

Version 0.14.0 (released 2019-10-15)
* added multi-layout support fo search results
* changed params passing to pagination and display of search result card
* changed params passing to pagination and display of search result card

Version 0.13.0 (released 2019-10-01)
* Removed Semantic-UI import from the library and moved to the demo app
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-searchkit",
"version": "0.15.0",
"version": "0.16.0",
"description": "React components to build your search UI application",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
Expand Down
18 changes: 18 additions & 0 deletions src/lib/api/contrib/invenio/InvenioSearchApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,24 @@ export class InvenioSearchApi {
...config,
};
this.http = axios.create(axiosConfig);
if (config.interceptors) {
this.addInterceptors(config.interceptors);
}
}

addInterceptors(interceptors) {
if (interceptors.request) {
this.http.interceptors.request.use(
interceptors.request.resolve,
interceptors.request.reject
);
}
if (interceptors.response) {
this.http.interceptors.response.use(
interceptors.response.resolve,
interceptors.response.reject
);
}
}

/**
Expand Down