fixing sign out issues

This commit is contained in:
Arjun Patel
2022-01-18 14:25:23 -08:00
parent e6f3e7f0aa
commit e5546a62aa
4 changed files with 42 additions and 7 deletions
+13 -2
View File
@@ -50,8 +50,11 @@ const db = getFirestore();
export function TeamDashboardContextProvider({ children }) {
const { currUser } = useAuth();
const [loading, setLoading] = useState<Boolean>(true);
const router = useRouter();
const [loading, setLoading] = useState<Boolean>(true);
const { teamid } = router.query;
// this context can only be used if it's a specific route: '/teams'
@@ -212,7 +215,9 @@ export function TeamDashboardContextProvider({ children }) {
})();
return () => {
userListener();
if (userListener) {
userListener();
}
unsubs.forEach((unsub) => {
unsub();
@@ -232,6 +237,12 @@ export function TeamDashboardContextProvider({ children }) {
useEffect(() => {
// todo for new messages, change document.title
if (!currUser) {
console.log("not authenticated...routing from dashboard to teams home");
router.push("/teams/login");
return;
}
/**
* QUERY:
* - last 24 hours only