diff --git a/pages/teams/index.tsx b/pages/teams/index.tsx index 60a7169..0ffea2d 100644 --- a/pages/teams/index.tsx +++ b/pages/teams/index.tsx @@ -1,6 +1,6 @@ import { useAuth } from "../../contexts/authContext" import { useRouter } from "next/router" -import { useEffect } from "react" +import { useEffect, useState } from "react" import UserService from '../../services/userService' import { User } from "../../models/user" import { GetServerSidePropsContext } from "next" @@ -15,6 +15,7 @@ function RouteHandler({ user }) { const { currUser } = useAuth() const router = useRouter() const userService: UserService = new UserService() + const [loading, setLoading] = useState(false) useEffect(() => { @@ -35,7 +36,9 @@ function RouteHandler({ user }) { router.push('/teams/profile') } - // check if user is in a team or has created one + // check if user is in a team go to the team dashboard + + } catch(error) { console.log(error) @@ -44,6 +47,10 @@ function RouteHandler({ user }) { })(); }, [currUser]) + if (loading) { + return
figuring out where you should go
+ } + return (
this is the route handler page
) diff --git a/services/userService.tsx b/services/userService.tsx index 40e417b..edc4a3a 100644 --- a/services/userService.tsx +++ b/services/userService.tsx @@ -5,11 +5,7 @@ import { User } from '../models/user' export default class UserService { private db : Firestore = getFirestore() private static collectionName: string = "users" - - constructor() { - - } - + // give back the avatar based on the person's google account avatar getUserAvatar(displayName: string) { return `https://ui-avatars.com/api/?name=${displayName}`