From 52764f51cd7d893a307755dd1eacd28cee4ecddd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Mart=C3=ADnez=20Casta=C3=B1=C3=B3n?= Date: Thu, 4 May 2023 10:13:52 +0200 Subject: [PATCH] fix: display the friends when the app is deployed --- .../src/components/place/PrivacyComponent.tsx | 25 +++++-------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/webapp/src/components/place/PrivacyComponent.tsx b/webapp/src/components/place/PrivacyComponent.tsx index 1d72e6a1..f1f18c5e 100644 --- a/webapp/src/components/place/PrivacyComponent.tsx +++ b/webapp/src/components/place/PrivacyComponent.tsx @@ -26,8 +26,6 @@ interface PrivacyComponentState { */ class PrivacyComponent extends Component { - private loadedFriends: boolean = false; - constructor(props: PrivacyComponentProps) { super(props); this.state = { @@ -35,7 +33,7 @@ class PrivacyComponent extends Component(), friendsSelected: [], - loadedFriends: false, + loadedFriends: true, friendsButton: false, prevFriendsButton: false, }; @@ -44,21 +42,10 @@ class PrivacyComponent extends Component { - if (this.state.friendsList.length === 0) { - this.setState(() => ({ - loadedFriends: false, - })); - } else { - this.setState(() => ({ - loadedFriends: true, - })); - } - }).catch((error) => { - this.setState(() => ({ - loadedFriends: true, + await this.getUsers().catch((error) => { + this.setState({ friendsList: [] - })); + }); }); } @@ -66,8 +53,8 @@ class PrivacyComponent extends Component