diff --git a/src/services/gasPrice/index.ts b/src/services/gasPrice/index.ts index 7f7df04f..d4ddf6b9 100644 --- a/src/services/gasPrice/index.ts +++ b/src/services/gasPrice/index.ts @@ -1,6 +1,9 @@ import { HYDRATE } from 'next-redux-wrapper' import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react' +const REFETCH_INTERVAL = 60 * 30 +const CACHE_DURATION = 60 * 60 + export const gasPriceApi = createApi({ reducerPath: 'gasPriceApi', extractRehydrationInfo(action, { reducerPath }) { @@ -12,8 +15,8 @@ export const gasPriceApi = createApi({ baseQuery: fetchBaseQuery({ baseUrl: '/api/gas-price', }), - refetchOnMountOrArgChange: 60 * 30, - keepUnusedDataFor: 60 * 60, + refetchOnMountOrArgChange: REFETCH_INTERVAL, + keepUnusedDataFor: CACHE_DURATION, tagTypes: ['GasPrice'], refetchOnFocus: true, endpoints: (builder) => ({ diff --git a/src/services/treasury/restApi/index.ts b/src/services/treasury/restApi/index.ts index d3a5ab85..b69943d5 100644 --- a/src/services/treasury/restApi/index.ts +++ b/src/services/treasury/restApi/index.ts @@ -8,6 +8,9 @@ import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react' import { HYDRATE } from 'next-redux-wrapper' import { fraxLendQueryObject } from '../queries' +const REFETCH_INTERVAL = 60 * 30 +const CACHE_DURATION = 60 * 60 + export type TResponseData = { response: ContractDetailsType[] } @@ -53,8 +56,8 @@ export const treasuryRestApi = createApi({ return null }, baseQuery: customBaseQuery, - refetchOnMountOrArgChange: 60 * 30, - keepUnusedDataFor: 60 * 60, + refetchOnMountOrArgChange: REFETCH_INTERVAL, + keepUnusedDataFor: CACHE_DURATION, refetchOnFocus: true, tagTypes: ['Tokens', 'Protocols', 'TokenInfo'], endpoints: (builder) => ({