mirror of
https://github.com/linsa-io/linsa.git
synced 2026-04-30 20:24:20 +02:00
* feat: Start using guest auth * feat: Implement more functionality to work as guest * chore: update package and tweak public route * chore: update root package json * chore: update web package json --------- Co-authored-by: Aslam H <iupin5212@gmail.com>
29 lines
730 B
TypeScript
29 lines
730 B
TypeScript
"use client"
|
|
|
|
import { createJazzReactApp } from "jazz-react"
|
|
import { LaAccount } from "@/lib/schema"
|
|
import { useClerk } from "@clerk/nextjs"
|
|
import { useJazzClerkAuth } from "jazz-react-auth-clerk"
|
|
|
|
const Jazz = createJazzReactApp({
|
|
AccountSchema: LaAccount
|
|
})
|
|
|
|
export const { useAccount, useAccountOrGuest, useCoState, useAcceptInvite } = Jazz
|
|
|
|
export function JazzAndAuth({ children }: { children: React.ReactNode }) {
|
|
const clerk = useClerk()
|
|
|
|
const [auth, state] = useJazzClerkAuth(clerk)
|
|
|
|
return (
|
|
<>
|
|
{state.errors.map((error) => (
|
|
<div key={error}>{error}</div>
|
|
))}
|
|
<Jazz.Provider auth={auth || "guest"} peer="wss://mesh.jazz.tools/?key=example@gmail.com">
|
|
{children}
|
|
</Jazz.Provider>
|
|
</>
|
|
)
|
|
} |