1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Start up process of API calls

Prepare for announcement fetching
This commit is contained in:
Zhiyuan Zheng
2020-12-22 01:09:34 +01:00
parent 436b0ab4dd
commit 4d6cee643b
5 changed files with 43 additions and 20 deletions

View File

@ -18,8 +18,11 @@ import { useTheme } from '@utils/styles/ThemeManager'
import getCurrentTab from '@utils/getCurrentTab'
import { toast, toastConfig } from '@components/toast'
import { useTranslation } from 'react-i18next'
import { useSelector } from 'react-redux'
import { getLocalUrl } from './utils/slices/instancesSlice'
import { useDispatch, useSelector } from 'react-redux'
import {
getLocalUrl,
updateLocalAccountPreferences
} from '@utils/slices/instancesSlice'
enableScreens()
const Tab = createBottomTabNavigator<RootStackParamList>()
@ -37,6 +40,7 @@ export interface Props {
}
export const Index: React.FC<Props> = ({ localCorrupt }) => {
const dispatch = useDispatch()
const localInstance = useSelector(getLocalUrl)
const { i18n } = useTranslation()
const { mode, theme } = useTheme()
@ -57,6 +61,12 @@ export const Index: React.FC<Props> = ({ localCorrupt }) => {
return showLocalCorrect
}, [localCorrupt])
useEffect(() => {
if (localInstance) {
dispatch(updateLocalAccountPreferences())
}
}, [])
return (
<>
<StatusBar barStyle={barStyle[mode]} />