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