Updating useeffect

This commit is contained in:
aeroreyna
2022-11-21 15:15:28 -05:00
parent a313822c27
commit 1972aa7464
6 changed files with 27 additions and 15 deletions

View File

@@ -5,11 +5,17 @@ import API from './../API.js';
import LoginForm from './../components/Login.js';
export default function App({navigation, route}) {
useEffect(async () => {
let r = await API.isLoggedIn();
if(r){
await API.logout();
navigation.navigate('Login')
useEffect(()=>{
getData = async () => {
let r = await API.isLoggedIn();
if(r){
await API.logout();
navigation.navigate('Login')
}
}
getData();
return ()=>{
}
}, []);

View File

@@ -19,7 +19,6 @@ const getProfilePosts = async (profileid) => {
try {
const value = await AsyncStorage.getItem('profile_' + profileid)
if (value !== null) {
console.log(JSON.parse(value))
return JSON.parse(value);
}
return [];
@@ -61,7 +60,7 @@ let Profile = ({ navigation, route }) => {
return ()=>{
subscribed = false;
}
}, [route.params]);
}, [route.params?.profileid]);
const renderPost = (({ item }) => {
if (item.nonOrganicType)
return (<></>);