Browse Source

Merge branch 'main' of github.com:IGSD-UoW/WPD-MobileApp

master
GabrielTrettel 3 years ago
parent
commit
38503fed92
  1. 20
      src/App.js

20
src/App.js

@ -20,19 +20,31 @@ import getPluviometerStation from "./app/hooks/usePluviometricStation";
export default function App() {
const [user, setUser] = useState();
const [pluviometerStation, setPluviometerStation] = useState();
const [pluviometerStation, setPluviometerStation] = useState(undefined);
const [isReady, setIsReady] = useState();
const netInfo = useNetInfo();
useEffect(() => {
if (user?.username != null) {
getPluviometerStation(user.id, setPluviometerStation);
const pluv = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaah"
authStorage.setUser({ ...user, pluviometer: pluviometerStation });
if (pluviometerStation == undefined) {
getPluviometerStation(user.id, setPluviometerStation);
}
authStorage.setUser(user);
}
else{
setPluviometerStation(undefined);
}
}, [user]);
useEffect(() => {
if (user?.username != null) {
setUser({ ...user, pluviometer: pluviometerStation });
}
}, [pluviometerStation]);
console.log(pluviometerStation);
const restoreUser = async () => {
const storageUser = await authStorage.getUser();
if (storageUser) setUser(storageUser);

Loading…
Cancel
Save