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,
|
"when": 1749340800000,
|
||||||
"tag": "0012_verification_token_value_text",
|
"tag": "0012_verification_token_value_text",
|
||||||
"breakpoints": true
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 13,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1781194385000,
|
||||||
|
"tag": "0013_invoice_public_token_expiry",
|
||||||
|
"breakpoints": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import {
|
|||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import dynamic from "next/dynamic";
|
import dynamic from "next/dynamic";
|
||||||
import { authClient } from "~/lib/auth-client";
|
import { authClient } from "~/lib/auth-client";
|
||||||
|
import { useAuthSession } from "~/hooks/use-auth-session";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|
||||||
@@ -178,8 +179,7 @@ function isFullHexColor(value: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function SettingsContent() {
|
export function SettingsContent() {
|
||||||
const { data: session } = authClient.useSession();
|
const { data: session } = useAuthSession();
|
||||||
// const session = { user: null } as any;
|
|
||||||
const [name, setName] = useState("");
|
const [name, setName] = useState("");
|
||||||
const [deleteConfirmText, setDeleteConfirmText] = useState("");
|
const [deleteConfirmText, setDeleteConfirmText] = useState("");
|
||||||
const [importData, setImportData] = useState("");
|
const [importData, setImportData] = useState("");
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { Logo } from "~/components/branding/logo";
|
|||||||
import { SidebarTrigger } from "~/components/navigation/sidebar-trigger";
|
import { SidebarTrigger } from "~/components/navigation/sidebar-trigger";
|
||||||
import { Button } from "~/components/ui/button";
|
import { Button } from "~/components/ui/button";
|
||||||
import { Skeleton } from "~/components/ui/skeleton";
|
import { Skeleton } from "~/components/ui/skeleton";
|
||||||
|
import { useAuthSession } from "~/hooks/use-auth-session";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
|
|
||||||
interface NavbarProps {
|
interface NavbarProps {
|
||||||
@@ -13,8 +14,7 @@ interface NavbarProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function Navbar({ allowRegistration = true }: NavbarProps) {
|
export function Navbar({ allowRegistration = true }: NavbarProps) {
|
||||||
const { data: session, isPending } = authClient.useSession();
|
const { data: session, isPending } = useAuthSession();
|
||||||
// const session = { user: null } as any; const isPending = false;
|
|
||||||
const [isMobileNavOpen, setIsMobileNavOpen] = useState(false);
|
const [isMobileNavOpen, setIsMobileNavOpen] = useState(false);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import {
|
|||||||
import { getGravatarUrl } from "~/lib/gravatar";
|
import { getGravatarUrl } from "~/lib/gravatar";
|
||||||
import { Avatar, AvatarFallback, AvatarImage } from "~/components/ui/avatar";
|
import { Avatar, AvatarFallback, AvatarImage } from "~/components/ui/avatar";
|
||||||
import { useAppearance } from "~/components/providers/appearance-provider";
|
import { useAppearance } from "~/components/providers/appearance-provider";
|
||||||
|
import { useAuthSession } from "~/hooks/use-auth-session";
|
||||||
|
|
||||||
interface SidebarProps {
|
interface SidebarProps {
|
||||||
mobile?: boolean;
|
mobile?: boolean;
|
||||||
@@ -35,8 +36,7 @@ interface SidebarProps {
|
|||||||
|
|
||||||
export function Sidebar({ mobile, onClose }: SidebarProps) {
|
export function Sidebar({ mobile, onClose }: SidebarProps) {
|
||||||
const pathname = usePathname();
|
const pathname = usePathname();
|
||||||
const { data: session, isPending } = authClient.useSession();
|
const { data: session, isPending } = useAuthSession();
|
||||||
// const session = { user: null } as any; const isPending = false;
|
|
||||||
const { isCollapsed, toggleCollapse } = useSidebar();
|
const { isCollapsed, toggleCollapse } = useSidebar();
|
||||||
const { sidebarStyle } = useAppearance();
|
const { sidebarStyle } = useAppearance();
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { MenuIcon, X } from "lucide-react";
|
import { MenuIcon, X } from "lucide-react";
|
||||||
import { authClient } from "~/lib/auth-client";
|
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { usePathname } from "next/navigation";
|
import { usePathname } from "next/navigation";
|
||||||
import { Button } from "~/components/ui/button";
|
import { Button } from "~/components/ui/button";
|
||||||
import { Skeleton } from "~/components/ui/skeleton";
|
import { Skeleton } from "~/components/ui/skeleton";
|
||||||
|
import { useAuthSession } from "~/hooks/use-auth-session";
|
||||||
import { navigationConfig } from "~/lib/navigation";
|
import { navigationConfig } from "~/lib/navigation";
|
||||||
|
|
||||||
interface SidebarTriggerProps {
|
interface SidebarTriggerProps {
|
||||||
@@ -15,8 +15,7 @@ interface SidebarTriggerProps {
|
|||||||
|
|
||||||
export function SidebarTrigger({ isOpen, onToggle }: SidebarTriggerProps) {
|
export function SidebarTrigger({ isOpen, onToggle }: SidebarTriggerProps) {
|
||||||
const pathname = usePathname();
|
const pathname = usePathname();
|
||||||
const { isPending } = authClient.useSession();
|
const { isPending } = useAuthSession();
|
||||||
// const isPending = false;
|
|
||||||
|
|
||||||
return (
|
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