Commit 1e93102c authored by Matija Obreza's avatar Matija Obreza
Browse files

Fix: ensure Axios response interceptor is used

- Pagination from querystring updated
parent 140dc847
......@@ -29,7 +29,7 @@ class BrowsePage extends BrowsePageTemplate<Accession> {
const qs = parse(search || '');
const page = { direction: qs.d, properties: null };
if (qs.s) {
page.properties = [ ...qs.s ];
page.properties = [ qs.s ];
}
return applyFilters(filterCode || '', page);
},
......
......@@ -48,7 +48,7 @@ class BrowsePage extends React.Component<IOverviewPageProps, any> {
const qs = parse(search || '');
const page = { direction: qs.d, properties: null };
if (qs.s) {
page.properties = [ ...qs.s ];
page.properties = [ qs.s ];
}
return applyOverviewFilters(filterCode || '', page);
},
......
......@@ -27,7 +27,7 @@ class BrowsePage extends BrowsePageTemplate<FaoInstitute> {
const qs = parse(search || '');
const page = { direction: qs.d, properties: null };
if (qs.s) {
page.properties = [ ...qs.s ];
page.properties = [ qs.s ];
}
return applyFilters(filterCode || '', page);
},
......
......@@ -132,7 +132,7 @@ class SubsetService {
s: page.properties || undefined,
}, {});
const apiUrl = URL_LIST + (qs ? `?${qs}` : '');
// console.log(`Fetching from ${apiUrl}`);
console.log(`Fetching from ${apiUrl}`, page);
const content = { data: typeof filter === 'string' ? null : { ...filter } };
return axiosBackend.request({
......
......@@ -47,7 +47,7 @@ export const updateRoute = (paged: FilteredPage<Subset>) => (dispatch) => {
};
export const applyFilters = (filters: string | SubsetFilter, page: IPageRequest = { page: 0 }) => (dispatch) => {
console.log('Applying new filter', filters);
console.log('Applying new filter', filters, page);
return SubsetService.list(filters, page)
.then((paged) => {
dispatch(receiveSubsets(paged));
......
......@@ -28,7 +28,7 @@ class BrowsePage extends BrowsePageTemplate<Subset> {
const qs = parse(search || '');
const page = { direction: qs.d, properties: null };
if (qs.s) {
page.properties = [ ...qs.s ];
page.properties = [ qs.s ];
}
return applyFilters(filterCode || '', page);
},
......
......@@ -45,7 +45,7 @@ class DashboardPage extends React.Component<IDashboardPageProps> {
const qs = parse(search || '');
const page = { direction: qs.d, properties: null };
if (qs.s) {
page.properties = [ ...qs.s ];
page.properties = [ qs.s ];
}
return applyFilters(filterCode || '', page);
},
......
import axios from 'axios';
import ApiError from 'model/ApiError';
axios.interceptors.response.use((response) => {
return response;
}, (error) => {
return Promise.reject(ApiError.axiosError(error));
});
import axios from 'axios';
import ApiError from 'model/ApiError';
axios.interceptors.response.use((response) => {
return response;
}, (error) => {
return Promise.reject(ApiError.axiosError(error));
});
/**
* Default Axios configuration for accessing the backend API
*/
......@@ -17,8 +25,9 @@ axiosBackend.interceptors.request.use((config) => {
console.log('Backend API request to ', config.url);
return config;
}, (error) => {
console.log('Backend error!!');
// Do something with request error
return Promise.reject(error);
return Promise.reject(ApiError.axiosError(error));
});
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment