chore: use acc guest instead for action

This commit is contained in:
Aslam H
2024-11-09 16:05:43 +07:00
parent 02009c2baf
commit 7eda38955e

View File

@@ -3,14 +3,15 @@ import { toast } from "sonner"
import { LaAccount, PersonalPage } from "@/lib/schema" import { LaAccount, PersonalPage } from "@/lib/schema"
import { ID } from "jazz-tools" import { ID } from "jazz-tools"
import { useNavigate } from "@tanstack/react-router" import { useNavigate } from "@tanstack/react-router"
import { useAccount } from "~/lib/providers/jazz-provider" import { useAccountOrGuest } from "~/lib/providers/jazz-provider"
export const usePageActions = () => { export const usePageActions = () => {
const { me } = useAccount() const { me } = useAccountOrGuest()
const navigate = useNavigate() const navigate = useNavigate()
const newPage = React.useCallback(() => { const newPage = React.useCallback(() => {
if (!me) return if (!me) return
if (me._type !== "Account") return
const page = PersonalPage.create( const page = PersonalPage.create(
{ public: false, createdAt: new Date(), updatedAt: new Date() }, { public: false, createdAt: new Date(), updatedAt: new Date() },