refactor: replace js-cookie auth with new auth client and remove unused packages from web package (#50)

This commit is contained in:
LovelessCodes
2025-06-07 13:44:32 +02:00
committed by GitHub
parent d1d37840fc
commit efe83ec8a9
3 changed files with 3 additions and 33 deletions

View File

@@ -1,22 +1,15 @@
import Cookies from "js-cookie";
import PatternedBackground from "~/components/PatternedBackground";
import { useTheme } from "~/providers/theme";
import { api } from "~/utils/api";
import Footer from "./Footer";
import Header from "./Header";
import { authClient } from "@kan/auth/client";
export default function Layout({ children }: { children: React.ReactNode }) {
const theme = useTheme();
const token =
typeof window !== "undefined" ? Cookies.get("kan.session_token") : null;
const { data: session } = authClient.useSession();
const { data } = api.user.getUser.useQuery(undefined, {
enabled: !!token,
});
const isLoggedIn = !!data;
const isLoggedIn = !!session?.user;
const isDarkMode = theme.activeTheme === "dark";