Please help me, I entered this code below but It doesn't work. When I give the correct email and password I get the error message ->

Here is my code:
const loginUser = (email, password, location, history) => {
setIsLoading(true);
signInWithEmailAndPassword(auth, email, password)
.then(() => {
const destination = location?.state?.from || "/";
history.replace(destination);
setError("");
})
.catch((error) => {
setError(error.message);
})
.finally(() => setIsLoading(false));
};