added k8s specific changes
This commit is contained in:
@@ -13,9 +13,11 @@ spec:
|
||||
labels:
|
||||
app: website
|
||||
spec:
|
||||
imagePullSecrets:
|
||||
- name: harbor-secret
|
||||
containers:
|
||||
- name: website
|
||||
image: 192.168.49.2:30004/vaishnavi-ecommerce/website:latest
|
||||
image: 192.168.108.200:80/vaishnavi-ecommerce/website:latest
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 5173
|
||||
|
||||
@@ -8,7 +8,7 @@ metadata:
|
||||
spec:
|
||||
ingressClassName: nginx
|
||||
rules:
|
||||
- host: website.local
|
||||
- host: vaishnavi-test.myriadcara.in
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
|
||||
@@ -4,10 +4,9 @@ metadata:
|
||||
name: website
|
||||
namespace: ecommerce
|
||||
spec:
|
||||
type: NodePort
|
||||
type: LoadBalancer
|
||||
selector:
|
||||
app: website
|
||||
ports:
|
||||
- port: 5173
|
||||
targetPort: 5173
|
||||
nodePort: 30081
|
||||
|
||||
@@ -21,10 +21,12 @@
|
||||
|
||||
import { ShoppingCart } from "lucide-react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { useSelector } from "react-redux";
|
||||
import { useGetCartItemsQuery } from "../../features/cart/cartAPI";
|
||||
|
||||
const CartIcon = ({ className = "" }) => {
|
||||
const { data } = useGetCartItemsQuery();
|
||||
const token = useSelector((state) => state.auth.token);
|
||||
const { data } = useGetCartItemsQuery(undefined, { skip: !token });
|
||||
|
||||
const cartCount = data?.data?.items?.length || 0;
|
||||
|
||||
|
||||
@@ -195,11 +195,13 @@ import {
|
||||
import { useAddToCartMutation } from "../../features/cart/cartAPI";
|
||||
import WishlistEmpty from "./WishlistEmpty";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { useSelector } from "react-redux";
|
||||
|
||||
const Wishlist = () => {
|
||||
const navigate = useNavigate();
|
||||
const token = useSelector((state) => state.auth.token);
|
||||
|
||||
const { data, isLoading, isError } = useGetWishlistQuery();
|
||||
const { data, isLoading, isError } = useGetWishlistQuery(undefined, { skip: !token });
|
||||
const [addToCart] = useAddToCartMutation();
|
||||
const [removeFromWishlist] = useRemoveFromWishlistMutation();
|
||||
|
||||
|
||||
@@ -207,6 +207,7 @@
|
||||
import React, { useState } from "react";
|
||||
import { useGetOrdersQuery } from "../../features/orders/ordersApi";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { useSelector } from "react-redux";
|
||||
import { statusColor } from "../../constants/statusColor";
|
||||
|
||||
// const statusColor = {
|
||||
@@ -347,10 +348,11 @@ const OrderCard = ({ order }) => {
|
||||
|
||||
// MAIN COMPONENT
|
||||
const MyOrders = () => {
|
||||
const { data, isLoading, isError } = useGetOrdersQuery({
|
||||
page: 1,
|
||||
limit: 50,
|
||||
});
|
||||
const token = useSelector((state) => state.auth.token);
|
||||
const { data, isLoading, isError } = useGetOrdersQuery(
|
||||
{ page: 1, limit: 50 },
|
||||
{ skip: !token }
|
||||
);
|
||||
|
||||
const [filters, setFilters] = useState({
|
||||
status: [],
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import React, { useState } from "react";
|
||||
import { useParams, Link } from "react-router-dom";
|
||||
import { useSelector } from "react-redux";
|
||||
import Pagination from "../ui/Pagination";
|
||||
import Breadcrumb from "../ui/Breadcrumb";
|
||||
import CategoryGrid from "../home/Category/CategoryGrid";
|
||||
@@ -16,8 +17,9 @@ import { Heart, Eye } from "lucide-react";
|
||||
const ProductCategoryPage = () => {
|
||||
const { parent, category, subCategory } = useParams();
|
||||
const categorySlug = subCategory || category;
|
||||
const token = useSelector((state) => state.auth.token);
|
||||
|
||||
const { data: wishlistData } = useGetWishlistQuery();
|
||||
const { data: wishlistData } = useGetWishlistQuery(undefined, { skip: !token });
|
||||
const [addToWishlist] = useAddToWishlistMutation();
|
||||
const [removeFromWishlist] = useRemoveFromWishlistMutation();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useParams } from "react-router-dom";
|
||||
import { useEffect } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import Breadcrumb from "../../components/ui/Breadcrumb";
|
||||
import ProductImages from "./ProductImages";
|
||||
import ProductInfo from "./ProductInfo";
|
||||
@@ -19,9 +19,10 @@ import RecommendedForYou from "../home/RecommendedForYou/RecommendedForYou";
|
||||
const ProductDetails = () => {
|
||||
const { slug } = useParams();
|
||||
const dispatch = useDispatch();
|
||||
const token = useSelector((state) => state.auth.token);
|
||||
|
||||
const { data, isLoading, isError } = useGetProductBySlugQuery(slug);
|
||||
const { data: wishlistData } = useGetWishlistQuery();
|
||||
const { data: wishlistData } = useGetWishlistQuery(undefined, { skip: !token });
|
||||
|
||||
const [addToWishlist] = useAddToWishlistMutation();
|
||||
const [removeFromWishlist] = useRemoveFromWishlistMutation();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { useGetProfileQuery } from "../../features/auth/authApi";
|
||||
// import { useDispatch } from "react-redux";
|
||||
@@ -10,7 +10,8 @@ import ProfileContent from "./ProfileContent";
|
||||
const ProfilePage = () => {
|
||||
const dispatch = useDispatch();
|
||||
const navigate = useNavigate();
|
||||
const { data, isLoading, isError } = useGetProfileQuery();
|
||||
const token = useSelector((state) => state.auth.token);
|
||||
const { data, isLoading, isError } = useGetProfileQuery(undefined, { skip: !token });
|
||||
const [activeTab, setActiveTab] = useState("profile"); // <--- state lifted
|
||||
|
||||
if (isLoading) return <p className="text-center py-10">Loading profile...</p>;
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import { useState } from "react";
|
||||
import { useSelector } from "react-redux";
|
||||
import { useGetAddressesQuery } from "../../../features/auth/authApi";
|
||||
import AddressCard from "./AddressCard";
|
||||
import UpdateAddressModal from "./UpdateAddressModal";
|
||||
|
||||
const Addresses = () => {
|
||||
const { data, isLoading, isError } = useGetAddressesQuery();
|
||||
const token = useSelector((state) => state.auth.token);
|
||||
const { data, isLoading, isError } = useGetAddressesQuery(undefined, { skip: !token });
|
||||
const addresses = data?.data?.addresses || [];
|
||||
|
||||
const [selectedAddress, setSelectedAddress] = useState(null);
|
||||
|
||||
@@ -204,8 +204,9 @@ const RecentlyViewedCard = ({ product, wishlistIds, handleWishlist }) => {
|
||||
const RecentlyViewed = ({ limit = 6 }) => {
|
||||
const allProducts = useSelector(selectRecentProducts);
|
||||
const recentProducts = allProducts.slice(0, limit);
|
||||
const token = useSelector((state) => state.auth.token);
|
||||
|
||||
const { data: wishlistData } = useGetWishlistQuery();
|
||||
const { data: wishlistData } = useGetWishlistQuery(undefined, { skip: !token });
|
||||
const [addToWishlist] = useAddToWishlistMutation();
|
||||
const [removeFromWishlist] = useRemoveFromWishlistMutation();
|
||||
|
||||
|
||||
@@ -9,11 +9,13 @@ import EmptyCart from "./EmptyCart";
|
||||
import ProgressStepper from "./ProgressStepper";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import CartFeatures from "./CartFeatures";
|
||||
import { useSelector } from "react-redux";
|
||||
|
||||
const CartPage = () => {
|
||||
const navigate = useNavigate();
|
||||
const token = useSelector((state) => state.auth.token);
|
||||
|
||||
const { data, isLoading, error } = useGetCartItemsQuery();
|
||||
const { data, isLoading, error } = useGetCartItemsQuery(undefined, { skip: !token });
|
||||
const cartItems = data?.data || [];
|
||||
const [quantities, setQuantities] = useState({});
|
||||
|
||||
|
||||
@@ -4,4 +4,7 @@ import react from '@vitejs/plugin-react'
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
preview: {
|
||||
allowedHosts: ['vaishnavi-test.myriadcara.in'],
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user