This commit is contained in:
Samandar Turgunboyev
2026-01-24 16:46:02 +05:00
parent 1f77cc360d
commit ecc0029322
24 changed files with 632 additions and 563 deletions

View File

@@ -17,7 +17,9 @@ import {
SheetTitle,
SheetTrigger,
} from '@/shared/ui/sheet';
import { banner_api } from '@/widgets/welcome/lib/api';
import { categoryList } from '@/widgets/welcome/lib/data';
import { userStore } from '@/widgets/welcome/lib/hook';
import { PopoverTrigger } from '@radix-ui/react-popover';
import { useMutation, useQuery } from '@tanstack/react-query';
import {
@@ -53,6 +55,7 @@ const Navbar = () => {
const { cart_id } = useCartId();
const [cartQuenty, setCartQuenty] = useState<number>(0);
const { setCartId } = useCartId();
const { setUser } = userStore();
const { mutate: cart } = useMutation({
mutationFn: () => cart_api.create(),
@@ -61,6 +64,17 @@ const Navbar = () => {
},
});
const { data: me } = useQuery({
queryKey: ['get_me'],
queryFn: () => banner_api.getMe(),
});
useEffect(() => {
if (me) {
setUser(me.data);
}
}, [me]);
useEffect(() => {
if (token) {
cart();