import { useTranslation } from 'react-i18next' import { toast } from 'sonner' import { useAuthStore } from '@/stores/auth-store' import { ConfirmDialog } from '@/components/confirm-dialog' import { logout } from '@/features/auth/api' interface SignOutDialogProps { open: boolean onOpenChange: (open: boolean) => void } export function SignOutDialog({ open, onOpenChange }: SignOutDialogProps) { const { t } = useTranslation() const { auth } = useAuthStore() const handleSignOut = async () => { try { await logout() } catch { /* empty */ } auth.reset() try { if (typeof window !== 'undefined') { window.localStorage.removeItem('uid') } } catch { /* empty */ } toast.success(t('Signed out')) // Refresh the page to clear all state and update UI if (typeof window !== 'undefined') { window.location.reload() } } return ( ) }