action refresh fixed
This commit is contained in:
+2
-1
@@ -8,9 +8,10 @@ function App() {
|
|||||||
const queryClient = new QueryClient({
|
const queryClient = new QueryClient({
|
||||||
defaultOptions: {
|
defaultOptions: {
|
||||||
queries: {
|
queries: {
|
||||||
// staleTime: Infinity,
|
|
||||||
refetchOnWindowFocus: false,
|
refetchOnWindowFocus: false,
|
||||||
retry: 3,
|
retry: 3,
|
||||||
|
// refetchOnMount: false,
|
||||||
|
staleTime: 3000
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export default function RecentActions() {
|
|||||||
|
|
||||||
return (
|
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-header">
|
||||||
<div className="card-heading">
|
<div className="card-heading">
|
||||||
<h4 className="card-title">Recent Actions</h4>
|
<h4 className="card-title">Recent Actions</h4>
|
||||||
|
|||||||
@@ -1,16 +1,17 @@
|
|||||||
import { useQuery } from '@tanstack/react-query'
|
import { useQuery } from '@tanstack/react-query'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { recentActions } from '../../services/services'
|
import { topBar } from '../../services/services'
|
||||||
import queryKeys from '../../services/queryKeys'
|
import queryKeys from '../../services/queryKeys'
|
||||||
|
|
||||||
export default function TopBar() {
|
export default function TopBar() {
|
||||||
|
|
||||||
const {data:dataAction, isFetching, isError, error} = useQuery({
|
const {data, isFetching, isError, error} = useQuery({
|
||||||
queryKey: queryKeys.recentAction,
|
queryKey: queryKeys.topBar,
|
||||||
queryFn: () => recentActions()
|
queryFn: () => topBar()
|
||||||
})
|
})
|
||||||
|
|
||||||
const actionData = dataAction?.data?.action_data
|
const topData = data?.data?.bar_data?.top_bar
|
||||||
|
console.log('TOP', topData)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -30,7 +31,7 @@ export default function TopBar() {
|
|||||||
</div>
|
</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'
|
let textColor = item?.description == 'Contacts' ? 'text-danger' : item?.description == 'Site Traffic' ? 'text-primary' : item?.description == 'Appointments' ? 'text-orange' : 'text-success'
|
||||||
return (
|
return (
|
||||||
<div key={item.id + index} className="col-sm-6 col-xxl-3">
|
<div key={item.id + index} className="col-sm-6 col-xxl-3">
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
const queryKeys = {
|
const queryKeys = {
|
||||||
dashboard: ['dashboard'],
|
dashboard: ['dashboard'],
|
||||||
|
topBar: ['top-bar'],
|
||||||
recentAction: ['recent-action'],
|
recentAction: ['recent-action'],
|
||||||
product: ['product-data'],
|
product: ['product-data'],
|
||||||
product_url: ['product_url']
|
product_url: ['product_url']
|
||||||
|
|||||||
@@ -72,6 +72,11 @@ export const accountDashboard = () => {
|
|||||||
return getAuxEnd(`/panel/account/dash`)
|
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
|
// FUNCTION TO GET DASHBOARD RECENT ACTIONS SECTION
|
||||||
export const recentActions = () => {
|
export const recentActions = () => {
|
||||||
return getAuxEnd(`/panel/account/actions`)
|
return getAuxEnd(`/panel/account/actions`)
|
||||||
|
|||||||
Reference in New Issue
Block a user