action refresh fixed
This commit is contained in:
+2
-1
@@ -8,9 +8,10 @@ function App() {
|
||||
const queryClient = new QueryClient({
|
||||
defaultOptions: {
|
||||
queries: {
|
||||
// staleTime: Infinity,
|
||||
refetchOnWindowFocus: false,
|
||||
retry: 3,
|
||||
// refetchOnMount: false,
|
||||
staleTime: 3000
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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,5 +1,6 @@
|
||||
const queryKeys = {
|
||||
dashboard: ['dashboard'],
|
||||
topBar: ['top-bar'],
|
||||
recentAction: ['recent-action'],
|
||||
product: ['product-data'],
|
||||
product_url: ['product_url']
|
||||
|
||||
@@ -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`)
|
||||
|
||||
Reference in New Issue
Block a user