Skip to content

Commit

Permalink
fix: Fixed a bug in the authentication status changes
Browse files Browse the repository at this point in the history
  • Loading branch information
LakioLive committed Dec 23, 2024
1 parent d3c9fbb commit d5b365c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/components/pages/map/MapPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ export default function MapPage() {
const [isPositionLoading, setIsPositionLoading] = useState<boolean>(true);
const [isAuthenticated, setIsAuthenticated] = useState<boolean>(false);

useEffect(() => {
fetchPositions(setPositions, setIsPositionLoading);
}, []);

useEffect(() => {
const unsubscribe = onAuthStateChanged(auth, (user) => {
if (user) {
Expand All @@ -83,6 +79,12 @@ export default function MapPage() {
};
}, []);

useEffect(() => {
if (isAuthenticated) {
fetchPositions(setPositions, setIsPositionLoading);
}
}, [isAuthenticated]);

const updateDatesStorage = (markerId: number, dates: IDates[]) => {
setDatesStorage((prevState) => ({
...prevState,
Expand Down

0 comments on commit d5b365c

Please sign in to comment.