fix: missing publicTokenExpiresAt
This commit is contained in:
@@ -0,0 +1 @@
|
||||
ALTER TABLE "beenvoice_invoice" ADD COLUMN IF NOT EXISTS "publicTokenExpiresAt" timestamp;
|
||||
@@ -92,6 +92,13 @@
|
||||
"when": 1749340800000,
|
||||
"tag": "0012_verification_token_value_text",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 13,
|
||||
"version": "7",
|
||||
"when": 1781194385000,
|
||||
"tag": "0013_invoice_public_token_expiry",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import {
|
||||
} from "lucide-react";
|
||||
import dynamic from "next/dynamic";
|
||||
import { authClient } from "~/lib/auth-client";
|
||||
import { useAuthSession } from "~/hooks/use-auth-session";
|
||||
import * as React from "react";
|
||||
import { useState } from "react";
|
||||
|
||||
@@ -178,8 +179,7 @@ function isFullHexColor(value: string) {
|
||||
}
|
||||
|
||||
export function SettingsContent() {
|
||||
const { data: session } = authClient.useSession();
|
||||
// const session = { user: null } as any;
|
||||
const { data: session } = useAuthSession();
|
||||
const [name, setName] = useState("");
|
||||
const [deleteConfirmText, setDeleteConfirmText] = useState("");
|
||||
const [importData, setImportData] = useState("");
|
||||
|
||||
@@ -6,6 +6,7 @@ import { Logo } from "~/components/branding/logo";
|
||||
import { SidebarTrigger } from "~/components/navigation/sidebar-trigger";
|
||||
import { Button } from "~/components/ui/button";
|
||||
import { Skeleton } from "~/components/ui/skeleton";
|
||||
import { useAuthSession } from "~/hooks/use-auth-session";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
interface NavbarProps {
|
||||
@@ -13,8 +14,7 @@ interface NavbarProps {
|
||||
}
|
||||
|
||||
export function Navbar({ allowRegistration = true }: NavbarProps) {
|
||||
const { data: session, isPending } = authClient.useSession();
|
||||
// const session = { user: null } as any; const isPending = false;
|
||||
const { data: session, isPending } = useAuthSession();
|
||||
const [isMobileNavOpen, setIsMobileNavOpen] = useState(false);
|
||||
const router = useRouter();
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ import {
|
||||
import { getGravatarUrl } from "~/lib/gravatar";
|
||||
import { Avatar, AvatarFallback, AvatarImage } from "~/components/ui/avatar";
|
||||
import { useAppearance } from "~/components/providers/appearance-provider";
|
||||
import { useAuthSession } from "~/hooks/use-auth-session";
|
||||
|
||||
interface SidebarProps {
|
||||
mobile?: boolean;
|
||||
@@ -35,8 +36,7 @@ interface SidebarProps {
|
||||
|
||||
export function Sidebar({ mobile, onClose }: SidebarProps) {
|
||||
const pathname = usePathname();
|
||||
const { data: session, isPending } = authClient.useSession();
|
||||
// const session = { user: null } as any; const isPending = false;
|
||||
const { data: session, isPending } = useAuthSession();
|
||||
const { isCollapsed, toggleCollapse } = useSidebar();
|
||||
const { sidebarStyle } = useAppearance();
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
"use client";
|
||||
|
||||
import { MenuIcon, X } from "lucide-react";
|
||||
import { authClient } from "~/lib/auth-client";
|
||||
import Link from "next/link";
|
||||
import { usePathname } from "next/navigation";
|
||||
import { Button } from "~/components/ui/button";
|
||||
import { Skeleton } from "~/components/ui/skeleton";
|
||||
import { useAuthSession } from "~/hooks/use-auth-session";
|
||||
import { navigationConfig } from "~/lib/navigation";
|
||||
|
||||
interface SidebarTriggerProps {
|
||||
@@ -15,8 +15,7 @@ interface SidebarTriggerProps {
|
||||
|
||||
export function SidebarTrigger({ isOpen, onToggle }: SidebarTriggerProps) {
|
||||
const pathname = usePathname();
|
||||
const { isPending } = authClient.useSession();
|
||||
// const isPending = false;
|
||||
const { isPending } = useAuthSession();
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { authClient } from "~/lib/auth-client";
|
||||
|
||||
type AuthSession = typeof authClient.$Infer.Session;
|
||||
|
||||
export function useAuthSession() {
|
||||
const [session, setSession] = useState<AuthSession | null>(null);
|
||||
const [isPending, setIsPending] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
let isCurrent = true;
|
||||
|
||||
async function loadSession() {
|
||||
const { data } = await authClient.getSession().catch(() => ({
|
||||
data: null,
|
||||
}));
|
||||
|
||||
if (isCurrent) {
|
||||
setSession(data);
|
||||
setIsPending(false);
|
||||
}
|
||||
}
|
||||
|
||||
void loadSession();
|
||||
|
||||
return () => {
|
||||
isCurrent = false;
|
||||
};
|
||||
}, []);
|
||||
|
||||
return { data: session, isPending };
|
||||
}
|
||||
Reference in New Issue
Block a user