|
|
@ -1,17 +1,31 @@ |
|
|
import { Ionicons } from '@expo/vector-icons'; |
|
|
import { Ionicons } from '@expo/vector-icons'; |
|
|
import { useFocusEffect } from '@react-navigation/native'; |
|
|
import { useFocusEffect } from '@react-navigation/native'; |
|
|
import i18n from 'i18n-js'; |
|
|
import i18n from 'i18n-js'; |
|
|
import { Avatar, Button, Divider, FormControl, List, Select, Stack, Text, View } from 'native-base'; |
|
|
import { |
|
|
|
|
|
Avatar, |
|
|
|
|
|
Button, |
|
|
|
|
|
Divider, |
|
|
|
|
|
FormControl, |
|
|
|
|
|
List, |
|
|
|
|
|
Select, |
|
|
|
|
|
Stack, |
|
|
|
|
|
Text, |
|
|
|
|
|
View, |
|
|
|
|
|
} from 'native-base'; |
|
|
import PropTypes from 'prop-types'; |
|
|
import PropTypes from 'prop-types'; |
|
|
import React, { useCallback, useState } from 'react'; |
|
|
import React, { useCallback, useState } from 'react'; |
|
|
import { getProfileDetail } from '../../api/IdentityAPI'; |
|
|
import { getProfileDetail } from '../../api/IdentityAPI'; |
|
|
import AppActions from '../../store/actions/AppActions'; |
|
|
import AppActions from '../../store/actions/AppActions'; |
|
|
import { |
|
|
import { |
|
|
createLanguageSelector, |
|
|
createLanguageSelector, |
|
|
createLanguagesSelector |
|
|
createLanguagesSelector, |
|
|
} from '../../store/selectors/AppSelectors'; |
|
|
} from '../../store/selectors/AppSelectors'; |
|
|
import { createTenantSelector } from '../../store/selectors/PersistentStorageSelectors'; |
|
|
import { createTenantSelector } from '../../store/selectors/PersistentStorageSelectors'; |
|
|
import { connectToRedux } from '../../utils/ReduxConnect'; |
|
|
import { connectToRedux } from '../../utils/ReduxConnect'; |
|
|
|
|
|
import { store } from '../../store/index'; |
|
|
|
|
|
import { getEnvVars } from '../../../Environment'; |
|
|
|
|
|
|
|
|
|
|
|
const env = getEnvVars(); |
|
|
|
|
|
|
|
|
function SettingsScreen({ |
|
|
function SettingsScreen({ |
|
|
navigation, |
|
|
navigation, |
|
|
@ -22,6 +36,7 @@ function SettingsScreen({ |
|
|
tenant = {}, |
|
|
tenant = {}, |
|
|
}) { |
|
|
}) { |
|
|
const [user, setUser] = useState({}); |
|
|
const [user, setUser] = useState({}); |
|
|
|
|
|
const [token, setToken] = useState(store.getState().persistentStorage.token); |
|
|
|
|
|
|
|
|
const fetchUser = () => { |
|
|
const fetchUser = () => { |
|
|
getProfileDetail().then(data => { |
|
|
getProfileDetail().then(data => { |
|
|
@ -35,6 +50,17 @@ function SettingsScreen({ |
|
|
}, []), |
|
|
}, []), |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const logout = () => { |
|
|
|
|
|
const { clientId } = env.oAuthConfig; |
|
|
|
|
|
const { access_token, refresh_token } = token; |
|
|
|
|
|
|
|
|
|
|
|
logoutAsync({ |
|
|
|
|
|
client_id: clientId, |
|
|
|
|
|
token: access_token, |
|
|
|
|
|
refresh_token: refresh_token, |
|
|
|
|
|
}); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<View> |
|
|
<View> |
|
|
<List px="0" py="0" borderWidth="0"> |
|
|
<List px="0" py="0" borderWidth="0"> |
|
|
@ -100,7 +126,7 @@ function SettingsScreen({ |
|
|
bg="danger.500" |
|
|
bg="danger.500" |
|
|
style={{ borderRadius: 0 }} |
|
|
style={{ borderRadius: 0 }} |
|
|
onPress={() => { |
|
|
onPress={() => { |
|
|
logoutAsync(); |
|
|
logout(); |
|
|
}}> |
|
|
}}> |
|
|
{i18n.t('AbpAccount::Logout')} |
|
|
{i18n.t('AbpAccount::Logout')} |
|
|
</Button> |
|
|
</Button> |
|
|
|