Skip to content

Commit

Permalink
/homeでサインインされていない場合、/signinにリダイレクトするようにした
Browse files Browse the repository at this point in the history
  • Loading branch information
yuto-trd committed Oct 27, 2024
1 parent 1052c64 commit b5045e8
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions task_yell/src/app/home/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
} from "@/components/ui/sheet";
import { Switch } from "@/components/ui/switch";
import { Textarea } from "@/components/ui/textarea";
import { auth } from "@/firebase/client-app";
import {
AngleIcon,
ListBulletIcon,
Expand Down Expand Up @@ -63,6 +64,7 @@ import {
Download,
LogOut,
} from "lucide-react";
import { useRouter } from "next/navigation";
import { useEffect, useMemo, useRef, useState } from "react";

type Priority = "low" | "medium" | "high";
Expand Down Expand Up @@ -365,6 +367,16 @@ export default function Home() {
const [isOpen, setIsOpen] = useState(false);
const [isNotificationsOpen, setIsNotificationsOpen] = useState(false);
const [notificationsEnabled, setNotificationsEnabled] = useState(false);
const router = useRouter();

useEffect(() => {
// サインインしていない場合、サインインページにリダイレクト
auth.authStateReady().then(() => {
if (!auth.currentUser) {
router.push("/signin");
}
});
}, [router]);

useEffect(() => {
if (isDarkMode) {
Expand Down

0 comments on commit b5045e8

Please sign in to comment.