Browse Source

restricting user action until api returns a response for PLUVIOVEMETER_REGISTRATION

master
analuizaff 3 years ago
parent
commit
7a67b85cbd
  1. 8
      src/app/hooks/usePluviometricStation.js
  2. 3
      src/app/screens/AccountScreen.js
  3. 2
      src/app/screens/PluviometerRegisterScreen.js

8
src/app/hooks/usePluviometricStation.js

@ -7,7 +7,7 @@ async function getPluvStation_data(id) {
if (result.data) {
return result;
}
return null;
return undefined;
}
function assemblePluvStationObject(pluvData) {
@ -64,14 +64,10 @@ async function getPluviometerStation(userId, setPluviometerStation) {
socketObject.onerror = (e) => {
console.log(e.message);
setPluviometerStation(null);
setPluviometerStation(undefined);
};
socketObject.close();
socketObject.onclose = () => {
console.log("FECHOU");
};
}
export default getPluviometerStation;

3
src/app/screens/AccountScreen.js

@ -102,10 +102,11 @@ function AccountScreen(props) {
return true
}
const profileItems = [
{
icon: "account",
show: isRegistered,
show: user.pluviometer != undefined,
IconProvider: MaterialCommunityIcons,
title: user.pluviometer? "Dados do pluviômetro" : "Cadastrar pluviômetro",
onPress: () => {

2
src/app/screens/PluviometerRegisterScreen.js

@ -224,7 +224,7 @@ function PluviometerRegisterScreen(props) {
}}
>
<View style={{ flex: 0.05 }}>
<Text style={styles.title}>Cadastro do Pluviômetro</Text>
<Text style={styles.title}>{user.pluviometer? "Dados do Pluviômetro" : "Cadastro do Pluviômetro"}</Text>
</View>
<View style={{ flex: 0.95, justifyContent: "space-between" }}>
<View style={{ flex: 0.19 }}>

Loading…
Cancel
Save