When I log in or register everything works perfectly. But if I reload the page I have to log in again. Is there any way around this? I have tried setting up persistence myself but it doesn’t work.
This is my code
const iniciarSesion = (e) => {
const auth = getAuth();
setPersistence(auth, browserLocalPersistence)
.then(() => {
signInWithEmailAndPassword(auth, email, password)
.then((userCredential) => {
setVentana("Tienda")
})
.catch((error) => {
console.log(error)
});
})
}
const registar = (e) => {
const auth = getAuth();
createUserWithEmailAndPassword(auth, email, password)
.then((userCredential) => {
setVentana("Tienda")
})
.catch((error) => {
console.error(error)
});
}