diff --git a/src/component/home/HomeSections.jsx b/src/component/home/HomeSections.jsx index 22d463a..a1eb2e0 100644 --- a/src/component/home/HomeSections.jsx +++ b/src/component/home/HomeSections.jsx @@ -1,6 +1,7 @@ import React from "react"; import BreadcrumbComBS from "../breadcrumb/BreadcrumbComBS"; import RecentActions from "./RecentActions"; +import Products from "./Products"; // import { useQuery } from "@tanstack/react-query"; // import { accountDashboard } from "../../services/services"; // import queryKeys from "../../services/queryKeys"; @@ -163,100 +164,7 @@ export default function HomeSections(){
-
-
-

My Products

-
-
-
-
-
-
- -
-
-

Activate now

-

Professional Website

-
-
-
- -
-
-
- -
-
-

Activate now

-

Professional Blog

-
-
-
- -
-
-
- -
-
-

Activate now

-

Business Website

-
-
-
-
-
-
- -
-
-

Activate now

-

Business Blog Site

-
-
-
- -
-
-
- -
-
-

Activate now

-

OpenEmr

-
-
-
-
-
-
- -
-
-

Activate now

-

Dummy

-
-
-
- - - {/*
*/} - {/*
*/} - {/*
*/} - {/* */} - {/*
*/} - {/*
*/} - {/*

Annual Revenue

*/} - {/*

$40,516

*/} - {/*
*/} - {/*
*/} - {/*
*/} -
-
-
-
-
-
+
diff --git a/src/component/home/Products.jsx b/src/component/home/Products.jsx new file mode 100644 index 0000000..8ab573a --- /dev/null +++ b/src/component/home/Products.jsx @@ -0,0 +1,71 @@ +import { useQuery } from '@tanstack/react-query' +import React from 'react' +import { productData } from '../../services/services' +import queryKeys from '../../services/queryKeys' + +export default function Products() { + + const {data, isFetching, isError, error} = useQuery({ + queryKey: queryKeys.product, + queryFn: () => productData() + }) + + const products = data?.data?.products_data?.products + + return ( + <> +
+
+

My Products

+
+
+ {isFetching ? + <> +
+
+

Loading...

+
+
+ + : isError ? +
+
+

{error.message}

+
+
+ : +
+ {products && products.map((product, index) => ( +
+
+
+ +
+
+

{product?.status}

+

{product?.description}

+
+
+
+ ))} + {/*
*/} + {/*
*/} + {/*
*/} + {/* */} + {/*
*/} + {/*
*/} + {/*

Annual Revenue

*/} + {/*

$40,516

*/} + {/*
*/} + {/*
*/} + {/*
*/} +
+ } +
+
+
+
+
+ + ) +} diff --git a/src/component/home/RecentActions.jsx b/src/component/home/RecentActions.jsx index 56fada0..f2a1128 100644 --- a/src/component/home/RecentActions.jsx +++ b/src/component/home/RecentActions.jsx @@ -10,6 +10,8 @@ export default function RecentActions() { queryFn: () => recentActions() }) + const actionData = dataAction?.data?.action_data + return ( <>
@@ -60,19 +62,19 @@ export default function RecentActions() {

Initial

-

{dataAction?.data?.action_data?.initial}

+

{actionData?.initial}

Processing

-

{dataAction?.data?.action_data?.processing}

+

{actionData?.processing}

Verifying

-

{dataAction?.data?.action_data?.verifying}

+

{actionData?.verifying}

Completed

-

{dataAction?.data?.action_data?.completed}

+

{actionData?.completed}

@@ -86,7 +88,7 @@ export default function RecentActions() { - {dataAction?.data?.action_data?.actions.map((action, index) => { + {actionData && actionData?.actions.map((action, index) => { let bgColor = action?.status == 'completed' ? 'badge-success-inverse' : action?.status == 'verifying' ? 'badge-info-inverse' : action?.status == 'processing' ? 'badge-warning-inverse' : 'badge-primary-inverse' return ( diff --git a/src/services/queryKeys.js b/src/services/queryKeys.js index 7b8b944..e184ee4 100644 --- a/src/services/queryKeys.js +++ b/src/services/queryKeys.js @@ -1,6 +1,7 @@ const queryKeys = { dashboard: ['dashboard'], - recentAction: ['recent-action'] + recentAction: ['recent-action'], + product: ['product-data'] } export default queryKeys \ No newline at end of file diff --git a/src/services/services.js b/src/services/services.js index 59d3621..5734986 100644 --- a/src/services/services.js +++ b/src/services/services.js @@ -60,3 +60,8 @@ export const accountDashboard = () => { export const recentActions = () => { return getAuxEnd(`/panel/account/actions`) } + +// FUNCTION TO GET DASHBOARD PRODUCT DATA SECTION +export const productData = () => { + return getAuxEnd(`/panel/account/products`) +}