mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-04 23:42:34 +00:00
Add two factor (#632)
This commit is contained in:
@ -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();
|
||||
|
||||
|
Reference in New Issue
Block a user