From 94d8e9f0efc6825fda9799bf44eb5da6dbc08f21 Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Thu, 12 Dec 2024 19:38:44 +0100 Subject: [PATCH] recent action API added --- .env.development | 2 +- src/component/home/HomeSections.jsx | 101 +-------------------- src/component/home/RecentActions.jsx | 131 +++++++++++++++++++++++++++ src/services/queryKeys.js | 3 +- src/services/services.js | 9 +- 5 files changed, 143 insertions(+), 103 deletions(-) create mode 100644 src/component/home/RecentActions.jsx diff --git a/.env.development b/.env.development index 12643e6..bfccf1f 100644 --- a/.env.development +++ b/.env.development @@ -1,7 +1,7 @@ SKIP_PREFLIGHT_CHECK=true REACT_APP_NODE_ENV="development" REACT_APP_SOCKET_URL="https://dev-socket.mermsemr.com" -REACT_APP_MAIN_API="https://devapi.mermsemr.com/" +REACT_APP_MAIN_API="https://devapi.mermsemr.com" REACT_APP_MEDIA_SERVER="https://dev-media.mermsemr.com" # Inactivity timeout/logout AT 10MINS diff --git a/src/component/home/HomeSections.jsx b/src/component/home/HomeSections.jsx index 3172ba9..22d463a 100644 --- a/src/component/home/HomeSections.jsx +++ b/src/component/home/HomeSections.jsx @@ -1,5 +1,6 @@ import React from "react"; import BreadcrumbComBS from "../breadcrumb/BreadcrumbComBS"; +import RecentActions from "./RecentActions"; // import { useQuery } from "@tanstack/react-query"; // import { accountDashboard } from "../../services/services"; // import queryKeys from "../../services/queryKeys"; @@ -258,105 +259,7 @@ export default function HomeSections(){
-
-
-
-

Recent Actions

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

Last Update

-

10-10-2021 10 AM

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

Initial

-

0

-
-
-

Processing

-

0

-
-
-

Verifying

-

0

-
-
-

Completed

-

0

-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#.DescriptionDateStatus
1Smith Drake27/3/2014 - -
2Martha Doe28/3/2015 - -
3Fenish Paul24/3/2015 - -
4Albom Mitch29/3/2016 - -
-
-
-
+
diff --git a/src/component/home/RecentActions.jsx b/src/component/home/RecentActions.jsx new file mode 100644 index 0000000..713f082 --- /dev/null +++ b/src/component/home/RecentActions.jsx @@ -0,0 +1,131 @@ +import React from 'react' +import { useQuery } from "@tanstack/react-query"; +import { recentActions } from "../../services/services"; +import queryKeys from "../../services/queryKeys"; + +export default function RecentActions() { + + const {data, isFetching, isError} = useQuery({ + queryKey: queryKeys.recentAction, + queryFn: async () => await recentActions() + }) +console.log('data', data) + return ( + <> +
+
+
+

Recent Actions

+
+ {/*
+ +
*/} +
+
+ {isFetching ? + <> +
+
+

Loading...

+
+
+ + : isError ? +
+
+

Error occured! Please refresh to continue

+
+
+ : + <> +
+
+

Last Update

+

10-10-2021 10 AM

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

Initial

+

0

+
+
+

Processing

+

0

+
+
+

Verifying

+

0

+
+
+

Completed

+

0

+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#.DescriptionDateStatus
1Smith Drake27/3/2014 + +
2Martha Doe28/3/2015 + +
3Fenish Paul24/3/2015 + +
4Albom Mitch29/3/2016 + +
+
+ + } +
+
+ + ) +} diff --git a/src/services/queryKeys.js b/src/services/queryKeys.js index e5485e8..7b8b944 100644 --- a/src/services/queryKeys.js +++ b/src/services/queryKeys.js @@ -1,5 +1,6 @@ const queryKeys = { - dashboard: ['dashboard'] + dashboard: ['dashboard'], + recentAction: ['recent-action'] } export default queryKeys \ No newline at end of file diff --git a/src/services/services.js b/src/services/services.js index 48a5c5b..9f9292b 100644 --- a/src/services/services.js +++ b/src/services/services.js @@ -36,8 +36,8 @@ const getAuxEnd = (path) => { // localStorage.clear(); // window.location.href = `/login?sessionExpired=true`; }).catch(err => { - // throw new Error(err.response.data.message); - return err + throw new Error(err.response.data.message); + // return err }) } @@ -54,3 +54,8 @@ export const loginUser = (reqData) => { export const accountDashboard = () => { return getAuxEnd(`/panel/account/dash`) } + +// FUNCTION TO GET DASHBOARD RECENT ACTIONS SECTION +export const recentActions = () => { + return getAuxEnd(`/panel/account/actions`) +}