Skip to content

Commit

Permalink
fixes render bug in alert list
Browse files Browse the repository at this point in the history
  • Loading branch information
dplumlee committed Feb 7, 2020
1 parent a98ad7a commit 4f7cbc4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
import qs from 'querystring';
import { HttpFetchQuery } from 'src/core/public';
import { AppAction } from '../action';
import { MiddlewareFactory } from '../../types';
import { MiddlewareFactory, AlertListData } from '../../types';

export const alertMiddlewareFactory: MiddlewareFactory = coreStart => {
const qp = qs.parse(window.location.search.slice(1));

return api => next => async (action: AppAction) => {
next(action);
if (action.type === 'userNavigatedToPage' && action.payload === 'alertsPage') {
const response = await coreStart.http.get('/api/endpoint/alerts', {
const response: AlertListData = await coreStart.http.get('/api/endpoint/alerts', {
query: qp as HttpFetchQuery,
});
api.dispatch({ type: 'serverReturnedAlertsData', payload: response });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const alertListReducer: Reducer<AlertListState, AppAction> = (
if (action.type === 'serverReturnedAlertsData') {
return {
...state,
alerts: action.payload.alerts,
...action.payload,
};
}

Expand Down

0 comments on commit 4f7cbc4

Please sign in to comment.