diff --git a/packages/admin/src/routes/_authenticated.tsx b/packages/admin/src/routes/_authenticated.tsx index d790e1c..f22f845 100644 --- a/packages/admin/src/routes/_authenticated.tsx +++ b/packages/admin/src/routes/_authenticated.tsx @@ -8,7 +8,8 @@ import { myPermissionsOptions } from '@/api/rbac' import { moduleListOptions } from '@/api/modules' import { Avatar } from '@/components/shared/avatar-upload' import { Button } from '@/components/ui/button' -import { Users, UserRound, HelpCircle, Shield, UserCog, LogOut, User, Wrench, Package, ClipboardList, FolderOpen, KeyRound, Settings, PanelLeftClose, PanelLeft, CalendarDays, GraduationCap, CalendarRange, BookOpen, BookMarked, Package2, Tag, Truck, ShoppingCart } from 'lucide-react' +import { Users, UserRound, HelpCircle, Shield, UserCog, LogOut, User, Wrench, Package, ClipboardList, FolderOpen, KeyRound, Settings, PanelLeftClose, PanelLeft, CalendarDays, GraduationCap, CalendarRange, BookOpen, BookMarked, Package2, Tag, Truck, ShoppingCart, AlertTriangle } from 'lucide-react' +import { Alert, AlertTitle, AlertDescription } from '@/components/ui/alert' export const Route = createFileRoute('/_authenticated')({ beforeLoad: () => { @@ -112,6 +113,13 @@ function AuthenticatedLayout() { const setPermissions = useAuthStore((s) => s.setPermissions) const permissionsLoaded = useAuthStore((s) => s.permissionsLoaded) + // Fetch profile for PIN warning + const { data: profile } = useQuery(queryOptions({ + queryKey: ['auth', 'me'], + queryFn: () => api.get<{ hasPin: boolean }>('/v1/auth/me'), + enabled: !!useAuthStore.getState().token, + })) + // Fetch permissions on mount const { data: permData } = useQuery({ ...myPermissionsOptions(), @@ -263,6 +271,18 @@ function AuthenticatedLayout() {
+ {profile && !profile.hasPin && ( + + + POS PIN not set + + You need a PIN to use the Point of Sale.{' '} + + Set your PIN + + + + )}
diff --git a/packages/admin/src/routes/_authenticated/profile.tsx b/packages/admin/src/routes/_authenticated/profile.tsx index e938c62..a651f15 100644 --- a/packages/admin/src/routes/_authenticated/profile.tsx +++ b/packages/admin/src/routes/_authenticated/profile.tsx @@ -12,8 +12,7 @@ import { Label } from '@/components/ui/label' import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' import { Separator } from '@/components/ui/separator' import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs' -import { Alert, AlertTitle, AlertDescription } from '@/components/ui/alert' -import { Sun, Moon, Monitor, AlertTriangle } from 'lucide-react' +import { Sun, Moon, Monitor } from 'lucide-react' import { toast } from 'sonner' import { AvatarUpload } from '@/components/shared/avatar-upload' @@ -53,23 +52,6 @@ function ProfilePage() {

Profile

- {profile && !profile.hasPin && ( - - - POS PIN not set - - You need a PIN to use the Point of Sale.{' '} - - Set your PIN - - - - )} - Account