create-croissant 0.1.17 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -50,15 +50,11 @@ const data = {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
|
|
53
|
-
const
|
|
53
|
+
const {
|
|
54
|
+
data: session,
|
|
55
|
+
} = authClient.useSession()
|
|
54
56
|
|
|
55
|
-
|
|
56
|
-
const checkSession = async () => {
|
|
57
|
-
const { data: sessionData } = await authClient.getSession()
|
|
58
|
-
setUser(sessionData?.user || null)
|
|
59
|
-
}
|
|
60
|
-
checkSession()
|
|
61
|
-
}, [])
|
|
57
|
+
const user = session?.user || null
|
|
62
58
|
|
|
63
59
|
return (
|
|
64
60
|
<Sidebar {...props}>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
|
|
3
|
-
const MOBILE_BREAKPOINT = 768
|
|
4
|
-
|
|
5
|
-
export function useIsMobile() {
|
|
6
|
-
const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined)
|
|
7
|
-
|
|
8
|
-
React.useEffect(() => {
|
|
9
|
-
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`)
|
|
10
|
-
const onChange = () => {
|
|
11
|
-
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
|
|
12
|
-
}
|
|
13
|
-
mql.addEventListener("change", onChange)
|
|
14
|
-
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
|
|
15
|
-
return () => mql.removeEventListener("change", onChange)
|
|
16
|
-
}, [])
|
|
17
|
-
|
|
18
|
-
return !!isMobile
|
|
19
|
-
}
|