mirror of
https://github.com/rustmailer/bichon.git
synced 2026-08-03 07:48:34 +02:00
update sign-out dialog
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import { useNavigate, useLocation } from '@tanstack/react-router'
|
import { useNavigate, useLocation } from '@tanstack/react-router'
|
||||||
import { ConfirmDialog } from '@/components/confirm-dialog'
|
import { ConfirmDialog } from '@/components/confirm-dialog'
|
||||||
import { resetToken } from '@/stores/authStore'
|
import { resetToken } from '@/stores/authStore'
|
||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
|
|
||||||
interface SignOutDialogProps {
|
interface SignOutDialogProps {
|
||||||
open: boolean
|
open: boolean
|
||||||
@@ -10,7 +11,7 @@ interface SignOutDialogProps {
|
|||||||
export function SignOutDialog({ open, onOpenChange }: SignOutDialogProps) {
|
export function SignOutDialog({ open, onOpenChange }: SignOutDialogProps) {
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const location = useLocation()
|
const location = useLocation()
|
||||||
|
const { t } = useTranslation()
|
||||||
const handleSignOut = () => {
|
const handleSignOut = () => {
|
||||||
resetToken()
|
resetToken()
|
||||||
const currentPath = location.href
|
const currentPath = location.href
|
||||||
@@ -25,12 +26,15 @@ export function SignOutDialog({ open, onOpenChange }: SignOutDialogProps) {
|
|||||||
<ConfirmDialog
|
<ConfirmDialog
|
||||||
open={open}
|
open={open}
|
||||||
onOpenChange={onOpenChange}
|
onOpenChange={onOpenChange}
|
||||||
title='Sign out'
|
title={t('sign_out.title', 'Sign out')}
|
||||||
desc='Are you sure you want to sign out? You will need to sign in again to access your account.'
|
desc={t(
|
||||||
confirmText='Sign out'
|
'sign_out.desc',
|
||||||
|
'Are you sure you want to sign out? You will need to sign in again to access your account.'
|
||||||
|
)}
|
||||||
|
confirmText={t('sign_out.confirm', 'Sign out')}
|
||||||
destructive
|
destructive
|
||||||
handleConfirm={handleSignOut}
|
handleConfirm={handleSignOut}
|
||||||
className='sm:max-w-sm'
|
className="sm:max-w-sm"
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user