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
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.1.17",
6
+ "version": "0.1.18",
7
7
  "description": "Scaffold a new project using the Croissant Stack",
8
8
  "repository": {
9
9
  "type": "git",
@@ -50,15 +50,11 @@ const data = {
50
50
  }
51
51
 
52
52
  export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
53
- const [user, setUser] = React.useState<typeof authClient.$Infer.Session.user | null>(null)
53
+ const {
54
+ data: session,
55
+ } = authClient.useSession()
54
56
 
55
- React.useEffect(() => {
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,3 +1,3 @@
1
- import { createAuthClient } from "better-auth/client";
1
+ import { createAuthClient } from "better-auth/react";
2
2
 
3
3
  export const authClient = createAuthClient();
@@ -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
- }