diff --git a/staff/tatiana-garcia/project/app/view/App.jsx b/staff/tatiana-garcia/project/app/view/App.jsx
index 1c55f5bd0..cc508b3f6 100644
--- a/staff/tatiana-garcia/project/app/view/App.jsx
+++ b/staff/tatiana-garcia/project/app/view/App.jsx
@@ -1,9 +1,13 @@
+import { useState } from 'react'
import { Routes, Route, useNavigate, Navigate } from 'react-router-dom'
import Register from './register'
import Login from './login/index.jsx'
import Home from './home/index.jsx'
import Contact from './contact/index.jsx'
+import Alert from './common/Alert.jsx'
+
+import { Context } from './context.js'
import logic from '../logic/index.js'
import Petsitters from './pettsiters/index.jsx'
@@ -11,11 +15,16 @@ import Petsitters from './pettsiters/index.jsx'
export default function App() {
const navigate = useNavigate()
+ const [alertMessage, setAlertMessage] = useState(null)
+
const handleLogin = () => { navigate('/') }
const handleRegisterClick = () => { navigate('/register') }
- const handleRegister = () => { navigate('/login') }
+ const handleRegister = () => {
+ setAlertMessage('¡Te has registrado correctamente! Ya puedes loguearte en Exoticus')
+ navigate('/login')
+ }
// const handleContact = () => { navigate('/contact') }
@@ -27,12 +36,17 @@ export default function App() {
navigate('/login')
}
- return
- } />
- : } />
- : } />
- } />
- } />
+ const handleAlertAccept = () => setAlertMessage(null)
+
+ return
+
+ } />
+ : } />
+ : } />
+ } />
+ } />
+
-
+ {alertMessage && }
+
}
\ No newline at end of file
diff --git a/staff/tatiana-garcia/project/app/view/common/Alert.jsx b/staff/tatiana-garcia/project/app/view/common/Alert.jsx
index 8751fed73..1c085e2c2 100644
--- a/staff/tatiana-garcia/project/app/view/common/Alert.jsx
+++ b/staff/tatiana-garcia/project/app/view/common/Alert.jsx
@@ -4,14 +4,14 @@ import Paragraph from '../library/Paragraph'
export default function Alert({ message, onAccept }) {
return <>
-
+
-
-
+
+
{message}
-
+
>
}
\ No newline at end of file
diff --git a/staff/tatiana-garcia/project/app/view/common/Confirm.jsx b/staff/tatiana-garcia/project/app/view/common/Confirm.jsx
index d735ec3ad..2ae4a1fc0 100644
--- a/staff/tatiana-garcia/project/app/view/common/Confirm.jsx
+++ b/staff/tatiana-garcia/project/app/view/common/Confirm.jsx
@@ -4,10 +4,11 @@ import Paragraph from '../library/Paragraph'
export default function Confirm({ message, onAccept, onCancel }) {
return <>
-
+
+
-
-
+
+
{message}
diff --git a/staff/tatiana-garcia/project/app/view/login/index.jsx b/staff/tatiana-garcia/project/app/view/login/index.jsx
index 67d094816..f41ae21e7 100644
--- a/staff/tatiana-garcia/project/app/view/login/index.jsx
+++ b/staff/tatiana-garcia/project/app/view/login/index.jsx
@@ -1,4 +1,6 @@
import { useNavigate } from 'react-router-dom'
+import useContext from '../context.js'
+
import logic from '../../logic/index.js'
import Header from '../home/Header.jsx'
@@ -17,6 +19,7 @@ import { errors } from '../../../com/index.js'
const { NotFoundError, CredentialsError } = errors
export default function Login({ onLogin, onRegisterClick }) {
+ const { alert } = useContext()
const handleLoginSubmit = event => {
event.preventDefault()
@@ -62,23 +65,29 @@ export default function Login({ onLogin, onRegisterClick }) {
- Login
+ Login
-
- ¿Eres nuevo/a? Regístrate
+
+ ¿Eres nuevo/a? Regístrate
+
+
diff --git a/staff/tatiana-garcia/project/app/view/register/index.jsx b/staff/tatiana-garcia/project/app/view/register/index.jsx
index 8a4b2502b..fe59dd8d5 100644
--- a/staff/tatiana-garcia/project/app/view/register/index.jsx
+++ b/staff/tatiana-garcia/project/app/view/register/index.jsx
@@ -8,7 +8,11 @@ import Footer from '../home/Footer'
import Heading from '../library/Heading'
import Header from '../home/Header'
+import useContext from '../context'
+
export default function Register({ onRegister, onLoginClick }) {
+ const { alert } = useContext()
+
const handleRegisterSubmit = event => {
event.preventDefault()
@@ -36,7 +40,7 @@ export default function Register({ onRegister, onLoginClick }) {
.catch(error => {
console.error(error)
- alert(error.message)
+ alert(message)
})
} catch (error) {
console.error(error)