diff --git a/src/app/screens/PasswordRecoveryScreen.js b/src/app/screens/PasswordRecoveryScreen.js index 6b094ea..5bea2c4 100644 --- a/src/app/screens/PasswordRecoveryScreen.js +++ b/src/app/screens/PasswordRecoveryScreen.js @@ -14,8 +14,7 @@ import { dimensions } from "../config/dimensions"; import assets from "../config/assets"; import PhoneNumberFormField from "../components/forms/PhoneNumberFormField"; import SearchablePicker from "../components/SearchablePicker"; - - +import ConfirmationModal from "../components/ConfirmationModal"; function SecQuestionPicker({ name }) { const [items, setItems] = useState([ @@ -72,9 +71,23 @@ const validationSchema = Yup.object().shape({ .max(255), }); -export default function PasswordRecovery({navigation}) { +export default function PasswordRecovery({ navigation }) { + const [confirmatioModalData, setConfirmatioModalData] = useState({ + show: false, + message: "", + }); + return ( + + setConfirmatioModalData({ ...confirmatioModalData, show: false }) + } + /> +
{ - navigation.navigate("PasswordRecoveryChangePswd") + // FIXME: This should be replaced by the proper api call in future + const apiReturnTest = 200; + + switch (apiReturnTest) { + case 200: + console.log("ir pra proxima tela...."); + navigation.navigate("PasswordRecoveryChangePswd") + break; + case 404: + setConfirmatioModalData({ + message: "Número de telefone inválido", + show: true, + }); + break; + case 422: + setConfirmatioModalData({ + message: "Pergunta de segurança ou senha incorretos", + show: true, + }); + break; + default: + setConfirmatioModalData({ + message: "Algo deu errado, tente novamente mais tarde", + show: true, + }); + break; + } }} > - - - Recuperação de senha - Responda à pergunta de segurança, isso ajuda a mostrar que - essa conta realmente pertence a você + + Recuperação de senha + + Responda à pergunta de segurança, isso ajuda a mostrar que essa + conta realmente pertence a você + @@ -102,14 +142,11 @@ export default function PasswordRecovery({navigation}) { /> - Pergunta*: - - Resposta*: - - - +
); @@ -142,11 +174,11 @@ const styles = StyleSheet.create({ textHeader: { textAlign: "center", fontWeight: "bold", - fontSize: 22 + fontSize: 22, }, textSubtitle: { textAlign: "center", fontSize: dimensions.text.secondary, marginVertical: 22, - } + }, });