mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-22 22:30:52 +01:00
Fix friends sorting (#158)
This commit is contained in:
parent
616c6668d9
commit
1f5ae7bd19
@ -16,14 +16,7 @@ const useFriendsState = () =>
|
||||
{
|
||||
const onlineFriends = friends.filter(friend => friend.online);
|
||||
|
||||
onlineFriends.sort((a, b) =>
|
||||
{
|
||||
if( a.name < b.name ) return -1;
|
||||
|
||||
if( a.name > b.name ) return 1;
|
||||
|
||||
return 0;
|
||||
});
|
||||
onlineFriends.sort((a, b) => a.name.toLowerCase().localeCompare(b.name.toLowerCase()));
|
||||
|
||||
return onlineFriends;
|
||||
}, [ friends ]);
|
||||
@ -32,14 +25,7 @@ const useFriendsState = () =>
|
||||
{
|
||||
const offlineFriends = friends.filter(friend => !friend.online);
|
||||
|
||||
offlineFriends.sort((a, b) =>
|
||||
{
|
||||
if( a.name < b.name ) return -1;
|
||||
|
||||
if( a.name > b.name ) return 1;
|
||||
|
||||
return 0;
|
||||
});
|
||||
offlineFriends.sort((a, b) => a.name.toLowerCase().localeCompare(b.name.toLowerCase()));
|
||||
|
||||
return offlineFriends;
|
||||
}, [ friends ]);
|
||||
|
Loading…
Reference in New Issue
Block a user