refactor: replace js-cookie auth with new auth client and remove unused packages from web package (#50)
This commit is contained in:
@@ -31,8 +31,6 @@
|
|||||||
"aws-sdk": "^2.1692.0",
|
"aws-sdk": "^2.1692.0",
|
||||||
"date-fns": "^4.1.0",
|
"date-fns": "^4.1.0",
|
||||||
"geist": "^1.3.1",
|
"geist": "^1.3.1",
|
||||||
"js-cookie": "^3.0.5",
|
|
||||||
"jwt-decode": "^4.0.0",
|
|
||||||
"next": "^14.2.15",
|
"next": "^14.2.15",
|
||||||
"next-logger": "^5.0.1",
|
"next-logger": "^5.0.1",
|
||||||
"next-runtime-env": "^1.7.2",
|
"next-runtime-env": "^1.7.2",
|
||||||
@@ -55,7 +53,6 @@
|
|||||||
"@kan/stripe": "workspace:*",
|
"@kan/stripe": "workspace:*",
|
||||||
"@kan/tailwind-config": "workspace:*",
|
"@kan/tailwind-config": "workspace:*",
|
||||||
"@kan/tsconfig": "workspace:*",
|
"@kan/tsconfig": "workspace:*",
|
||||||
"@types/js-cookie": "^3.0.6",
|
|
||||||
"@types/node": "^20.17.7",
|
"@types/node": "^20.17.7",
|
||||||
"@types/react": "catalog:react18",
|
"@types/react": "catalog:react18",
|
||||||
"@types/react-beautiful-dnd": "^13.1.7",
|
"@types/react-beautiful-dnd": "^13.1.7",
|
||||||
|
|||||||
@@ -1,22 +1,15 @@
|
|||||||
import Cookies from "js-cookie";
|
|
||||||
|
|
||||||
import PatternedBackground from "~/components/PatternedBackground";
|
import PatternedBackground from "~/components/PatternedBackground";
|
||||||
import { useTheme } from "~/providers/theme";
|
import { useTheme } from "~/providers/theme";
|
||||||
import { api } from "~/utils/api";
|
|
||||||
import Footer from "./Footer";
|
import Footer from "./Footer";
|
||||||
import Header from "./Header";
|
import Header from "./Header";
|
||||||
|
import { authClient } from "@kan/auth/client";
|
||||||
|
|
||||||
export default function Layout({ children }: { children: React.ReactNode }) {
|
export default function Layout({ children }: { children: React.ReactNode }) {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|
||||||
const token =
|
const { data: session } = authClient.useSession();
|
||||||
typeof window !== "undefined" ? Cookies.get("kan.session_token") : null;
|
|
||||||
|
|
||||||
const { data } = api.user.getUser.useQuery(undefined, {
|
const isLoggedIn = !!session?.user;
|
||||||
enabled: !!token,
|
|
||||||
});
|
|
||||||
|
|
||||||
const isLoggedIn = !!data;
|
|
||||||
|
|
||||||
const isDarkMode = theme.activeTheme === "dark";
|
const isDarkMode = theme.activeTheme === "dark";
|
||||||
|
|
||||||
|
|||||||
20
pnpm-lock.yaml
generated
20
pnpm-lock.yaml
generated
@@ -126,12 +126,6 @@ importers:
|
|||||||
geist:
|
geist:
|
||||||
specifier: ^1.3.1
|
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))
|
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:
|
next:
|
||||||
specifier: ^14.2.15
|
specifier: ^14.2.15
|
||||||
version: 14.2.20(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
version: 14.2.20(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||||
@@ -193,9 +187,6 @@ importers:
|
|||||||
'@kan/tsconfig':
|
'@kan/tsconfig':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../../tooling/typescript
|
version: link:../../tooling/typescript
|
||||||
'@types/js-cookie':
|
|
||||||
specifier: ^3.0.6
|
|
||||||
version: 3.0.6
|
|
||||||
'@types/node':
|
'@types/node':
|
||||||
specifier: ^20.17.7
|
specifier: ^20.17.7
|
||||||
version: 20.17.9
|
version: 20.17.9
|
||||||
@@ -2324,9 +2315,6 @@ packages:
|
|||||||
'@types/inquirer@6.5.0':
|
'@types/inquirer@6.5.0':
|
||||||
resolution: {integrity: sha512-rjaYQ9b9y/VFGOpqBEXRavc3jh0a+e6evAbI31tMda8VlPaSy0AZJfXsvmIe3wklc7W6C3zCSfleuMXR7NOyXw==}
|
resolution: {integrity: sha512-rjaYQ9b9y/VFGOpqBEXRavc3jh0a+e6evAbI31tMda8VlPaSy0AZJfXsvmIe3wklc7W6C3zCSfleuMXR7NOyXw==}
|
||||||
|
|
||||||
'@types/js-cookie@3.0.6':
|
|
||||||
resolution: {integrity: sha512-wkw9yd1kEXOPnvEeEV1Go1MmxtBJL0RR79aOTAApecWFVu7w0NNXNqhcWgvw2YgZDYadliXkl14pa3WXw5jlCQ==}
|
|
||||||
|
|
||||||
'@types/json-schema@7.0.15':
|
'@types/json-schema@7.0.15':
|
||||||
resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}
|
resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}
|
||||||
|
|
||||||
@@ -4066,10 +4054,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-ZZow9HBI5O6EPgSJLUb8n2NKgmVWTwCvHGwFuJlMjvLFqlGG6pjirPhtdsseaLZjSibD8eegzmYpUZwoIlj2cQ==}
|
resolution: {integrity: sha512-ZZow9HBI5O6EPgSJLUb8n2NKgmVWTwCvHGwFuJlMjvLFqlGG6pjirPhtdsseaLZjSibD8eegzmYpUZwoIlj2cQ==}
|
||||||
engines: {node: '>=4.0'}
|
engines: {node: '>=4.0'}
|
||||||
|
|
||||||
jwt-decode@4.0.0:
|
|
||||||
resolution: {integrity: sha512-+KJGIyHgkGuIq3IEBNftfhW/LfWhXUIY6OmyVWjliu5KH1y0fw7VQ8YndE2O4qZdMSd9SqbnC8GOcZEy0Om7sA==}
|
|
||||||
engines: {node: '>=18'}
|
|
||||||
|
|
||||||
katex@0.16.19:
|
katex@0.16.19:
|
||||||
resolution: {integrity: sha512-3IA6DYVhxhBabjSLTNO9S4+OliA3Qvb8pBQXMfC4WxXJgLwZgnfDl0BmB4z6nBMdznBsZ+CGM8DrGZ5hcguDZg==}
|
resolution: {integrity: sha512-3IA6DYVhxhBabjSLTNO9S4+OliA3Qvb8pBQXMfC4WxXJgLwZgnfDl0BmB4z6nBMdznBsZ+CGM8DrGZ5hcguDZg==}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
@@ -8088,8 +8072,6 @@ snapshots:
|
|||||||
'@types/through': 0.0.33
|
'@types/through': 0.0.33
|
||||||
rxjs: 6.6.7
|
rxjs: 6.6.7
|
||||||
|
|
||||||
'@types/js-cookie@3.0.6': {}
|
|
||||||
|
|
||||||
'@types/json-schema@7.0.15': {}
|
'@types/json-schema@7.0.15': {}
|
||||||
|
|
||||||
'@types/json5@0.0.29': {}
|
'@types/json5@0.0.29': {}
|
||||||
@@ -10074,8 +10056,6 @@ snapshots:
|
|||||||
object.assign: 4.1.5
|
object.assign: 4.1.5
|
||||||
object.values: 1.2.0
|
object.values: 1.2.0
|
||||||
|
|
||||||
jwt-decode@4.0.0: {}
|
|
||||||
|
|
||||||
katex@0.16.19:
|
katex@0.16.19:
|
||||||
dependencies:
|
dependencies:
|
||||||
commander: 8.3.0
|
commander: 8.3.0
|
||||||
|
|||||||
Reference in New Issue
Block a user