• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

atlp-rwanda / e-commerce-mavericks-fn / 10057347606

23 Jul 2024 10:34AM UTC coverage: 0.0%. Remained the same
10057347606

Pull #47

github

web-flow
Merge 62e4cdafa into a6ea4c698
Pull Request #47: [Finishes #187874853]Seller order Dashboard

0 of 117 branches covered (0.0%)

Branch coverage included in aggregate %.

0 of 324 new or added lines in 7 files covered. (0.0%)

1 existing line in 1 file now uncovered.

0 of 7609 relevant lines covered (0.0%)

0.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/App.tsx
1
import Register from './pages/Register';
×
2
import Success from './components/authentication/Success';
×
3
import RegisterSection from './components/authentication/RegisterSection';
×
4
import { RouterProvider, createBrowserRouter } from 'react-router-dom';
×
5
import Login from './pages/Login';
×
6
import LandingPage from './pages/LandingPage';
×
7
import GoogleAuthSuccess from './components/authentication/GoogleAuthSucces';
×
8
import { ToastContainer } from 'react-toastify';
×
9
import Searchpage from './containers/searchResults/SearchPage';
×
10
import { useDispatch } from 'react-redux';
×
11
import { ProductResponse, Product } from './types/Types';
×
12
import { useEffect, useRef } from 'react';
×
13
import { useGetProductsQuery } from './services/productApi';
×
14
import { setError, setIsLoading, setProductFetched, setProductsDataList } from './redux/slices/productsSlice';
×
15
import Checkout from './components/checkout/Checkout';
×
16
import RestrictedRoute from './components/dashboard/RestrictedRoute';
×
17
import AdminPage from './pages/admin';
×
18
import Category from './pages/admin/Category';
×
19
import Sellers from './pages/admin/Sellers';
×
20
import Buyers from './pages/admin/Buyers';
×
21
import UserManagement from './pages/admin/UserManagement';
×
22
import NotFoundPage from './pages/NotFoundPage';
×
23
import SellerSettings from './pages/seller/Settings';
×
24
import SellersPage from './pages/seller';
×
25
import Orders from './pages/seller/Orders';
×
26
import Products from './pages/seller/Products';
×
27
import Customers from './pages/seller/Customers';
×
28
import AdminSettings from './pages/admin/Settings';
×
29
import AddNewProduct from './pages/seller/AddNewProduct';
×
30
import RestrictedSellerRoute from './components/dashboard/RestrictedSellerLayout';
×
31
import CategoriesPage from './pages/CategoriesPage';
×
32
import ResetPassword from './pages/ResetPassword';
×
33
import NewPassword from './pages/NewPassword';
×
34
import { ProductDetail } from './pages/product/ProductDetail';
×
35
import Cart from './components/cart/Cart';
×
36
import { cartApi } from './services/cartApi';
×
37
import VerifyOTPPage from './pages/VerifyOTPPage';
×
38

×
39
const App = () => {
×
40
  const { data, error, isLoading } = useGetProductsQuery();
×
41
  const dispatch = useDispatch();
×
42
  const firstRender = useRef(true);
×
43

×
44
  const productsData: ProductResponse = data as unknown as ProductResponse;
×
45

×
46
  useEffect(() => {
×
47
    const fetchProducts = async () => {
×
48
      if (firstRender.current) {
×
49
        firstRender.current = false;
×
50
        return;
×
51
      }
×
52
      if (error) {
×
53
        dispatch(setError(error));
×
54
        dispatch(setIsLoading(false));
×
55
        dispatch(setProductFetched(false));
×
56
        return;
×
57
      }
×
58
      if (!isLoading && productsData) {
×
59
        const productsList = productsData.data as unknown as Product[];
×
60
        dispatch(setProductsDataList([...productsList]));
×
61
        dispatch(setIsLoading(false));
×
62
        dispatch(setProductFetched(true));
×
63
      }
×
64
    };
×
65
    fetchProducts();
×
66

×
67
    dispatch<any>(cartApi.endpoints.getCarts.initiate());
×
68
  }, [productsData, isLoading, dispatch]);
×
69

×
70
  const router = createBrowserRouter([
×
71
    {
×
72
      path: '/',
×
73
      children: [
×
74
        {
×
75
          index: true,
×
76
          element: <LandingPage />,
×
77
        },
×
78
        {
×
79
          path: 'login',
×
80
          element: <Login />,
×
81
        },
×
82
        {
×
83
          path: 'auth/success/:token',
×
84
          element: <GoogleAuthSuccess />,
×
85
        },
×
86
        {
×
87
          path: 'shoppingcart',
×
88
          element: <Cart />,
×
89
        },
×
90
        {
×
91
          path: 'categories/:categoryId',
×
92
          element: <CategoriesPage />,
×
93
        },
×
94
        {
×
95
          path: 'verifyOTP',
×
96
          element: <VerifyOTPPage />,
×
97
        },
×
98
        {
×
99
          path: '/reset-password',
×
100
          children: [
×
101
            { path: '', element: <ResetPassword /> },
×
102
            {
×
103
              path: ':token',
×
104
              element: <NewPassword />,
×
105
            },
×
106
          ],
×
107
        },
×
108
        {
×
109
          path: 'products/:id',
×
110
          element: <ProductDetail />,
×
111
        },
×
112
        {
×
113
          path: "/checkoutbag",
×
114
          element: <Checkout />
×
115
        },
×
116
      ],
×
117
    },
×
118
    {
×
119
      path: 'register',
×
120
      element: <Register />,
×
121
      children: [
×
122
        {
×
123
          path: '/register',
×
124
          element: <RegisterSection />,
×
125
        },
×
126
        { path: 'success', element: <Success /> },
×
127
      ],
×
128
    },
×
129
    {
×
130
      path: 'admin',
×
131
      element: <RestrictedRoute role='admin' />,
×
132
      children: [
×
133
        {
×
134
          index: true,
×
135
          element: <AdminPage />,
×
136
        },
×
137
        {
×
138
          path: 'categories',
×
139
          element: <Category />,
×
140
        },
×
141
        {
×
142
          path: 'sellers',
×
143
          element: <Sellers />,
×
144
        },
×
145
        {
×
146
          path: 'buyers',
×
147
          element: <Buyers />,
×
148
        },
×
149
        {
×
150
          path: 'users',
×
151
          element: <UserManagement />,
×
152
        },
×
153
        {
×
154
          path: 'settings',
×
155
          element: <AdminSettings />,
×
156
        },
×
157
      ],
×
158
    },
×
159
    {
×
160
      path: 'seller',
×
161
      element: <RestrictedSellerRoute role='seller' />,
×
162
      children: [
×
163
        {
×
164
          index: true,
×
165
          element: <SellersPage />,
×
166
        },
×
167
        {
×
168
          path: 'orders',
×
169
          element: <Orders />,
×
170
        },
×
171
        {
×
172
          path: 'products',
×
173
          element: <Products />,
×
174
        },
×
175
        {
×
176
          path: 'add-new-product',
×
177
          element: <AddNewProduct />,
×
178
        },
×
NEW
179
        {
×
NEW
180
          path: 'customers',
×
NEW
181
          element: <Customers />,
×
NEW
182
        },
×
NEW
183
        {
×
NEW
184
          path: 'settings',
×
NEW
185
          element: <SellerSettings />,
×
NEW
186
        },
×
187
      ],
×
188
    },
×
189
    {
×
190
      path: 'seller',
×
191
      children: [
×
192
        {
×
193
          index: true,
×
194
          element: <Orders />,
×
195
        }]
×
196
      },
×
197
    {
×
198
      path: 'search',
×
199
      element: <Searchpage />,
×
200
    },
×
201
    {
×
202
      path: '*',
×
203
      element: <NotFoundPage />,
×
204
    },
×
205
  ]);
×
206
  return (
×
207
    <>
×
208
      <RouterProvider router={router} />
×
209
      <ToastContainer />
×
210
    </>
×
211
  );
×
212
};
×
213

×
214
export default App;
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc