Add two factor (#632)

This commit is contained in:
Saeed Vaziry
2025-06-27 01:07:33 +02:00
committed by GitHub
parent 73c836bfe7
commit 194143d7ef
12 changed files with 388 additions and 49 deletions

View File

@ -1,7 +1,7 @@
import { AppSidebar } from '@/components/app-sidebar';
import { AppHeader } from '@/components/app-header';
import { type BreadcrumbItem, NavItem, SharedData } from '@/types';
import { type PropsWithChildren } from 'react';
import { type PropsWithChildren, useEffect } from 'react';
import { SidebarInset, SidebarProvider } from '@/components/ui/sidebar';
import { usePage } from '@inertiajs/react';
import { Toaster } from '@/components/ui/sonner';
@ -20,38 +20,40 @@ export default function Layout({
}>) {
const page = usePage<SharedData>();
if (page.props.flash && page.props.flash.success) {
toast(
<div className="flex items-center gap-2">
<CheckCircle2Icon className="text-success size-5" />
{page.props.flash.success}
</div>,
);
}
if (page.props.flash && page.props.flash.error) {
toast(
<div className="flex items-center gap-2">
<CircleXIcon className="text-destructive size-5" />
{page.props.flash.error}
</div>,
);
}
if (page.props.flash && page.props.flash.warning) {
toast(
<div className="flex items-center gap-2">
<TriangleAlertIcon className="text-warning size-5" />
{page.props.flash.warning}
</div>,
);
}
if (page.props.flash && page.props.flash.info) {
toast(
<div className="flex items-center gap-2">
<InfoIcon className="text-info size-5" />
{page.props.flash.info}
</div>,
);
}
useEffect(() => {
if (page.props.flash && page.props.flash.success) {
toast(
<div className="flex items-center gap-2">
<CheckCircle2Icon className="text-success size-5" />
{page.props.flash.success}
</div>,
);
}
if (page.props.flash && page.props.flash.error) {
toast(
<div className="flex items-center gap-2">
<CircleXIcon className="text-destructive size-5" />
{page.props.flash.error}
</div>,
);
}
if (page.props.flash && page.props.flash.warning) {
toast(
<div className="flex items-center gap-2">
<TriangleAlertIcon className="text-warning size-5" />
{page.props.flash.warning}
</div>,
);
}
if (page.props.flash && page.props.flash.info) {
toast(
<div className="flex items-center gap-2">
<InfoIcon className="text-info size-5" />
{page.props.flash.info}
</div>,
);
}
}, [page.props.flash]);
const queryClient = new QueryClient();