From e5cc5e677b54ca043604e61de7672b46e5c864bf Mon Sep 17 00:00:00 2001 From: Vyrtsev Mikhail Date: Sat, 29 Jun 2019 17:48:29 +0300 Subject: [PATCH] fix: settings widget fails because it expects list but gets null --- frontend/app/common/api.ts | 2 +- frontend/app/store/user/actions.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/app/common/api.ts b/frontend/app/common/api.ts index 4e008338..490bb2f6 100644 --- a/frontend/app/common/api.ts +++ b/frontend/app/common/api.ts @@ -220,7 +220,7 @@ export const unblockUser = ( withCredentials: true, }); -export const getBlocked = (): Promise => +export const getBlocked = (): Promise => fetcher.get({ url: '/admin/blocked', withCredentials: true, diff --git a/frontend/app/store/user/actions.ts b/frontend/app/store/user/actions.ts index ed384fcb..f71921c9 100644 --- a/frontend/app/store/user/actions.ts +++ b/frontend/app/store/user/actions.ts @@ -50,7 +50,7 @@ export const logout = (): StoreAction> => async dispatch => { }; export const fetchBlockedUsers = (): StoreAction> => async dispatch => { - const list = await api.getBlocked(); + const list = (await api.getBlocked()) || []; dispatch({ type: USER_BANLIST_SET, list,