bulk cart

This commit is contained in:
hamid zarghami
2025-12-01 10:33:22 +03:30
parent 788d23b185
commit b4b900cfc1
8 changed files with 83 additions and 11 deletions
+10 -3
View File
@@ -5,9 +5,13 @@ import { useAuthStore } from '@/zustand/authStore';
import { useRouter } from 'next/navigation';
import React from 'react'
import { useTranslation } from 'react-i18next'
import { removeToken, removeRefreshToken } from '@/lib/api/func';
export type LogoutPromptProps = Omit<PromptProps, 'onConfirm' | 'onCancel' | 'children'> & {
slug?: string;
};
function LogoutPrompt({ ...rest }: Omit<PromptProps, 'onConfirm' | 'onCancel' | 'children'>) {
function LogoutPrompt({ slug, ...rest }: LogoutPromptProps) {
const { t } = useTranslation('common', {
keyPrefix: 'LogoutModal'
});
@@ -15,12 +19,15 @@ function LogoutPrompt({ ...rest }: Omit<PromptProps, 'onConfirm' | 'onCancel' |
const router = useRouter();
const userIsAuthenticated = useAuthStore((state) => state.isAuthenticated);
const onConfirmLogout = (e: React.MouseEvent) => {
const onConfirmLogout = async (e: React.MouseEvent) => {
if (!e) return;
if (userIsAuthenticated) {
authLogout();
await removeToken();
await removeRefreshToken();
}
router.replace('/');
const redirectPath = slug ? `/${slug}` : '/';
router.replace(redirectPath);
};
const toggleShareModalVisiblity = (e: React.MouseEvent) => {