|
|
@@ -12,14 +12,14 @@ import { useCustomToast } from '@/utils/hooks/useToast';
|
|
|
import { useBodyScrollLock } from "@utils/hooks/useBodyScrollLock";
|
|
|
import OpenAuth from "../OpenAuth";
|
|
|
import { isObject } from '@/utils/type-guards';
|
|
|
-import { useGuestCartToken } from "@utils/hooks/useGuestCartToken";
|
|
|
import LoadingDots from "@components/common/icons/LoadingDots";
|
|
|
import { logoutAction } from "@utils/actions";
|
|
|
import { useAppDispatch, useAppSelector } from "@/store/hooks";
|
|
|
import { clearUser } from "@/store/slices/user-slice";
|
|
|
import { clearCart } from "@/store/slices/cart-slice";
|
|
|
import { EMAIL, removeFromLocalStorage } from "@/store/local-storage";
|
|
|
-
|
|
|
+import { setCookie, deleteCookie } from "@utils/cookie-tools";
|
|
|
+import { IS_GUEST,GUEST_CART_TOKEN,GUEST_CART_ID } from "@/utils/constants";
|
|
|
|
|
|
export default function CredentialModal({
|
|
|
children,
|
|
|
@@ -51,7 +51,6 @@ export default function CredentialModal({
|
|
|
const dispatch = useAppDispatch();
|
|
|
const { showToast } = useCustomToast();
|
|
|
|
|
|
- const { resetGuestToken } = useGuestCartToken();
|
|
|
|
|
|
useBodyScrollLock(finalIsOpen );
|
|
|
|
|
|
@@ -77,7 +76,9 @@ export default function CredentialModal({
|
|
|
redirect: false,
|
|
|
});
|
|
|
|
|
|
- await resetGuestToken();
|
|
|
+ deleteCookie(GUEST_CART_TOKEN);
|
|
|
+ deleteCookie(GUEST_CART_ID);
|
|
|
+ setCookie(IS_GUEST, 'true');
|
|
|
dispatch(clearUser());
|
|
|
dispatch(clearCart());
|
|
|
showToast("You are logged out successfully!", "success");
|