From c0a5462a5638e2729477e8ea8f46e2a05ee89097 Mon Sep 17 00:00:00 2001 From: Mustafa Buyukcelebi Date: Mon, 22 Jul 2019 14:37:40 +0300 Subject: [PATCH] Fixed adding same user name for other account issue --- src/redux/reducers/accountReducer.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/redux/reducers/accountReducer.js b/src/redux/reducers/accountReducer.js index a9aa1789a..bd968b14f 100644 --- a/src/redux/reducers/accountReducer.js +++ b/src/redux/reducers/accountReducer.js @@ -45,7 +45,9 @@ export default function(state = initialState, action) { case ADD_OTHER_ACCOUNT: return { ...state, - otherAccounts: [...state.otherAccounts, action.payload], + otherAccounts: state.otherAccounts.some(item => item.username === action.payload.username) + ? [...state.otherAccounts] + : [...state.otherAccounts, action.payload], isFetching: false, hasError: false, errorMessage: null,