refactor entitlements
This commit is contained in:
1 parent
9bfe146e2b
commit
b6a3d1e34d
5 files changed
+40
-21
No files matched your search
@@ -21,6 +21,7 @@ import { useDelete } from "@/hooks/UseApi";
|
||||
import { InitializingStatusBox } from "@/components/design-elements/StatusBox";
|
||||
import { useAppSelector } from "@/hooks/AppHooks";
|
||||
import { config } from "@/config/index";
|
||||
import { useLimitReached } from "@/hooks/UsePlanEntitlements";
|
||||
|
||||
const GLOBAL_REFRESH = config.GLOBAL_REFRESH;
|
||||
|
||||
@@ -67,7 +68,7 @@ const PageSpeedMonitorsPage = () => {
|
||||
const downCount = response?.data?.downCount || 0;
|
||||
const pausedCount = response?.data?.pausedCount || 0;
|
||||
|
||||
const monitorLimitReached = count >= (user?.entitlements?.monitorsMax || 0);
|
||||
const monitorLimitReached = useLimitReached("monitorsMax", count);
|
||||
|
||||
const handleConfirm = async () => {
|
||||
await deleteFn(`/monitors/${selectedMonitor?._id}`);
|
||||
|
||||
@@ -21,6 +21,7 @@ import { useDelete } from "@/hooks/UseApi";
|
||||
import { InitializingStatusBox } from "@/components/design-elements/StatusBox";
|
||||
import { useAppSelector } from "@/hooks/AppHooks";
|
||||
import { config } from "@/config/index";
|
||||
import { useLimitReached } from "@/hooks/UsePlanEntitlements";
|
||||
|
||||
const GLOBAL_REFRESH = config.GLOBAL_REFRESH;
|
||||
|
||||
@@ -68,7 +69,7 @@ const PageSpeedMonitorsPage = () => {
|
||||
const downCount = response?.data?.downCount || 0;
|
||||
const pausedCount = response?.data?.pausedCount || 0;
|
||||
|
||||
const monitorLimitReached = count >= (user?.entitlements?.monitorsMax || 0);
|
||||
const monitorLimitReached = useLimitReached("monitorsMax", count);
|
||||
|
||||
const handleConfirm = async () => {
|
||||
await deleteFn(`/monitors/${selectedMonitor?._id}`);
|
||||
|
||||
@@ -29,6 +29,7 @@ import { useState } from "react";
|
||||
import { useDelete } from "@/hooks/UseApi";
|
||||
import { useAppSelector } from "@/hooks/AppHooks";
|
||||
import { config } from "@/config/index";
|
||||
import { useLimitReached } from "@/hooks/UsePlanEntitlements";
|
||||
|
||||
const GLOBAL_REFRESH = config.GLOBAL_REFRESH;
|
||||
|
||||
@@ -94,7 +95,7 @@ const UptimeMonitors = () => {
|
||||
const downCount = response?.data?.downCount || 0;
|
||||
const pausedCount = response?.data?.pausedCount || 0;
|
||||
|
||||
const monitorLimitReached = count >= (user?.entitlements?.monitorsMax || 0);
|
||||
const monitorLimitReached = useLimitReached("monitorsMax", count);
|
||||
|
||||
const handleConfirm = async () => {
|
||||
await deleteFn(`/monitors/${selectedMonitor?._id}`);
|
||||
@@ -163,7 +164,7 @@ const UptimeMonitors = () => {
|
||||
setSortField={setSortField}
|
||||
sortOrder={sortOrder}
|
||||
setSortOrder={setSortOrder}
|
||||
count={monitors?.length || 0}
|
||||
count={count || 0}
|
||||
page={page}
|
||||
setPage={setPage}
|
||||
rowsPerPage={rowsPerPage}
|
||||
|
||||
Reference in new issue
Block a user