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

@@ -31,8 +31,6 @@
"aws-sdk": "^2.1692.0",
"date-fns": "^4.1.0",
"geist": "^1.3.1",
"js-cookie": "^3.0.5",
"jwt-decode": "^4.0.0",
"next": "^14.2.15",
"next-logger": "^5.0.1",
"next-runtime-env": "^1.7.2",
@@ -55,7 +53,6 @@
"@kan/stripe": "workspace:*",
"@kan/tailwind-config": "workspace:*",
"@kan/tsconfig": "workspace:*",
"@types/js-cookie": "^3.0.6",
"@types/node": "^20.17.7",
"@types/react": "catalog:react18",
"@types/react-beautiful-dnd": "^13.1.7",

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";

20
pnpm-lock.yaml generated
View File

@@ -126,12 +126,6 @@ importers:
geist:
specifier: ^1.3.1
version: 1.3.1(next@14.2.20(react-dom@18.3.1(react@18.3.1))(react@18.3.1))
js-cookie:
specifier: ^3.0.5
version: 3.0.5
jwt-decode:
specifier: ^4.0.0
version: 4.0.0
next:
specifier: ^14.2.15
version: 14.2.20(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
@@ -193,9 +187,6 @@ importers:
'@kan/tsconfig':
specifier: workspace:*
version: link:../../tooling/typescript
'@types/js-cookie':
specifier: ^3.0.6
version: 3.0.6
'@types/node':
specifier: ^20.17.7
version: 20.17.9
@@ -2324,9 +2315,6 @@ packages:
'@types/inquirer@6.5.0':
resolution: {integrity: sha512-rjaYQ9b9y/VFGOpqBEXRavc3jh0a+e6evAbI31tMda8VlPaSy0AZJfXsvmIe3wklc7W6C3zCSfleuMXR7NOyXw==}
'@types/js-cookie@3.0.6':
resolution: {integrity: sha512-wkw9yd1kEXOPnvEeEV1Go1MmxtBJL0RR79aOTAApecWFVu7w0NNXNqhcWgvw2YgZDYadliXkl14pa3WXw5jlCQ==}
'@types/json-schema@7.0.15':
resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}
@@ -4066,10 +4054,6 @@ packages:
resolution: {integrity: sha512-ZZow9HBI5O6EPgSJLUb8n2NKgmVWTwCvHGwFuJlMjvLFqlGG6pjirPhtdsseaLZjSibD8eegzmYpUZwoIlj2cQ==}
engines: {node: '>=4.0'}
jwt-decode@4.0.0:
resolution: {integrity: sha512-+KJGIyHgkGuIq3IEBNftfhW/LfWhXUIY6OmyVWjliu5KH1y0fw7VQ8YndE2O4qZdMSd9SqbnC8GOcZEy0Om7sA==}
engines: {node: '>=18'}
katex@0.16.19:
resolution: {integrity: sha512-3IA6DYVhxhBabjSLTNO9S4+OliA3Qvb8pBQXMfC4WxXJgLwZgnfDl0BmB4z6nBMdznBsZ+CGM8DrGZ5hcguDZg==}
hasBin: true
@@ -8088,8 +8072,6 @@ snapshots:
'@types/through': 0.0.33
rxjs: 6.6.7
'@types/js-cookie@3.0.6': {}
'@types/json-schema@7.0.15': {}
'@types/json5@0.0.29': {}
@@ -10074,8 +10056,6 @@ snapshots:
object.assign: 4.1.5
object.values: 1.2.0
jwt-decode@4.0.0: {}
katex@0.16.19:
dependencies:
commander: 8.3.0