mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-11-25 21:53:04 +03:00
code to avoid duplicate account entry in otherAccounts
This commit is contained in:
parent
886c754907
commit
f3cebcbff1
@ -72,7 +72,11 @@ export default function (state = initialState, action) {
|
||||
otherAccounts: state.otherAccounts.some(
|
||||
({ username }) => username === get(action.payload, 'username'),
|
||||
)
|
||||
? [...state.otherAccounts]
|
||||
//replace account data if it already exists
|
||||
? [...state.otherAccounts.filter(
|
||||
(item) => item.username !== action.payload.username), action.payload]
|
||||
|
||||
//add new account entry if it does not already exist
|
||||
: [...state.otherAccounts, action.payload],
|
||||
isFetching: false,
|
||||
hasError: false,
|
||||
|
Loading…
Reference in New Issue
Block a user