[FIX] Notification preferences menu shows nothing (#4703)

This commit is contained in:
Reinaldo Neto 2022-12-21 13:15:30 -03:00 committed by GitHub
parent 23f716c280
commit 0b5dab3ddf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -17,7 +17,7 @@ import log from '../../lib/methods/helpers/log';
const UserNotificationPreferencesView = () => {
const [preferences, setPreferences] = useState({} as INotificationPreferences);
const [loading, setLoading] = useState(false);
const [loading, setLoading] = useState(true);
const navigation = useNavigation<StackNavigationProp<ProfileStackParamList, 'UserNotificationPrefView'>>();
const userId = useAppSelector(state => getUserSelector(state).id);
@ -33,10 +33,11 @@ const UserNotificationPreferencesView = () => {
try {
const result = await Services.getUserPreferences(userId);
if (result.success) {
setLoading(true);
setLoading(false);
setPreferences(result.preferences);
}
} catch (error) {
setLoading(false);
log(error);
}
}
@ -63,6 +64,8 @@ const UserNotificationPreferencesView = () => {
<StatusBar />
<List.Container>
{loading ? (
<ActivityIndicator />
) : (
<>
<List.Section title='Desktop_Notifications'>
<List.Separator />
@ -103,8 +106,6 @@ const UserNotificationPreferencesView = () => {
<List.Info info='You_need_to_verifiy_your_email_address_to_get_notications' />
</List.Section>
</>
) : (
<ActivityIndicator />
)}
</List.Container>
</SafeAreaView>