action refresh fixed

This commit is contained in:
victorAnumudu
2024-12-21 23:28:06 +01:00
parent 4e86fba581
commit 3680abbef2
5 changed files with 16 additions and 8 deletions
+2 -1
View File
@@ -8,9 +8,10 @@ function App() {
const queryClient = new QueryClient({
defaultOptions: {
queries: {
// staleTime: Infinity,
refetchOnWindowFocus: false,
retry: 3,
// refetchOnMount: false,
staleTime: 3000
},
},
})
+1 -1
View File
@@ -14,7 +14,7 @@ export default function RecentActions() {
return (
<>
<div className="card card-statistics h-100 mb-0 panel_round_c2">
<div className="card card-statistics h-100 mb-0 panel_round_c2" style={{minHeight: '460px'}}>
<div className="card-header">
<div className="card-heading">
<h4 className="card-title">Recent Actions</h4>
+7 -6
View File
@@ -1,16 +1,17 @@
import { useQuery } from '@tanstack/react-query'
import React from 'react'
import { recentActions } from '../../services/services'
import { topBar } from '../../services/services'
import queryKeys from '../../services/queryKeys'
export default function TopBar() {
const {data:dataAction, isFetching, isError, error} = useQuery({
queryKey: queryKeys.recentAction,
queryFn: () => recentActions()
const {data, isFetching, isError, error} = useQuery({
queryKey: queryKeys.topBar,
queryFn: () => topBar()
})
const actionData = dataAction?.data?.action_data
const topData = data?.data?.bar_data?.top_bar
console.log('TOP', topData)
return (
<>
@@ -30,7 +31,7 @@ export default function TopBar() {
</div>
:
<>
{actionData && actionData?.top_bar?.map((item, index)=>{
{topData && topData?.map((item, index)=>{
let textColor = item?.description == 'Contacts' ? 'text-danger' : item?.description == 'Site Traffic' ? 'text-primary' : item?.description == 'Appointments' ? 'text-orange' : 'text-success'
return (
<div key={item.id + index} className="col-sm-6 col-xxl-3">
+1
View File
@@ -1,5 +1,6 @@
const queryKeys = {
dashboard: ['dashboard'],
topBar: ['top-bar'],
recentAction: ['recent-action'],
product: ['product-data'],
product_url: ['product_url']
+5
View File
@@ -72,6 +72,11 @@ export const accountDashboard = () => {
return getAuxEnd(`/panel/account/dash`)
}
// FUNCTION TO GET DASHBOARD TOP BAR SECTION
export const topBar = () => {
return getAuxEnd(`/panel/account/bar`)
}
// FUNCTION TO GET DASHBOARD RECENT ACTIONS SECTION
export const recentActions = () => {
return getAuxEnd(`/panel/account/actions`)