iamshaunjp/React-Redux-Firebase-App

Firebase permission denied: authError with useSelector

wooogler opened this issue · 0 comments

Hi, I'm Sangwook.
I'm studying to develop the react app with firebase.
Your Tutorial is SO COOL!!! Those are the best lectures!
I prefer to the latest version, so I create marioplan with react hooks and latest firebase library.

But, I have a trouble in Tutorial #32-Firestore Sercurity Rules.

I use "useSelector" for using authError in SignIn.js like this
const authError = useSelector(state => state.auth.authError);

After I signed in the app, when I log out,
there is a firebase error "Unhandled Rejection (FirebaseError): Missing or insufficient permissions."

I think it is because the app try to read the database for authError even user is not signed in.
So, I try to move the hooks into handleSubmit, but it is not allowed by hooks rule.

How can I solve this problem?
Thank you.