diff --git a/src/api/services/familyService.ts b/src/api/services/familyService.ts index 667dbe3..4a09375 100644 --- a/src/api/services/familyService.ts +++ b/src/api/services/familyService.ts @@ -8,6 +8,7 @@ interface Permission { permissionId: number; permissionTitle: string; createdAt: string; + is_enable: boolean; } interface MemberPermissionsResponse { diff --git a/src/components/Header.tsx b/src/components/Header.tsx index 9e300f1..79b89f7 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -118,18 +118,18 @@ export default function Header({ className={`h-16 ${darkMode ? "invert" : ""}`} /> ) : ( -

+

{getPageTitle()}

)} -
+
{showAlarmIcon && (
- {!isPublic ? ( + {!shouldShowData ? (
({ queryKey: ["familyMembers"], queryFn: () => familyService.getMembers().then((res) => res.data), - refetchInterval: 1000, + refetchInterval: 10000, refetchIntervalInBackground: true, placeholderData: keepPreviousData, // ← v5 방식 }); @@ -42,7 +42,7 @@ export default function Main() { const { data: usageData } = useQuery({ queryKey: ["UsageData"], queryFn: () => sharedPoolService.getUsageData().then((res) => res.data), - refetchInterval: 1000, // 10초마다 자동 폴링 + refetchInterval: 10000, // 10초마다 자동 폴링 refetchIntervalInBackground: true, // 백그라운드에서도 폴링 placeholderData: keepPreviousData, }); @@ -97,7 +97,7 @@ export default function Main() { useQuery({ queryKey: ["sharedPool"], queryFn: () => sharedPoolService.getMainRemainingAmount(), - refetchInterval: 1000, // 10초마다 자동 폴링 + refetchInterval: 10000, // 10초마다 자동 폴링 refetchIntervalInBackground: true, // 백그라운드에서도 폴링 placeholderData: keepPreviousData, }); @@ -109,7 +109,7 @@ export default function Main() { queryKey: ["blockStatus", lineId], queryFn: () => blockService.getBlockStatus(lineId!).then((res) => res.data), enabled: !!lineId, - refetchInterval: 1000, // 10초마다 자동 폴링 + refetchInterval: 10000, // 10초마다 자동 폴링 refetchIntervalInBackground: true, // 백그라운드에서도 폴링 placeholderData: keepPreviousData, }); diff --git a/src/page/Policy/components/Permisssion.tsx b/src/page/Policy/components/Permisssion.tsx index 88713e4..442817d 100644 --- a/src/page/Policy/components/Permisssion.tsx +++ b/src/page/Policy/components/Permisssion.tsx @@ -5,6 +5,7 @@ import Toggle from "@/components/common/Toggle"; import { permissionService } from "@/api/services/permissionService"; import type { PatchPermissionRequest } from "@/types/permission"; import { useToastStore } from "@/store/toastStore"; +import { familyService } from "@/api"; const PERMISSION_VIEW_DETAIL = "상세페이지 열람 권한"; const PERMISSION_HIDE_APP_USAGE = "앱 사용량 비공개 허용 권한"; @@ -128,6 +129,17 @@ function PermissionManager() { patchPermissions(changedPayload); }; + // 이미 캐시에 있는 데이터 가져오기 + const { data: familyMembers = [] } = useQuery({ + queryKey: ["familyMembersSimple"], + queryFn: () => familyService.getMembersSimple().then((res) => res.data), + staleTime: Infinity, // 이미 있으면 재요청 안함 + }); + + // lineId로 phone 찾기 + const getPhone = (lineId: number) => + familyMembers.find((m) => m.lineId === lineId)?.phone; + return ( <> (
- {row.userName} + + {row.userName} + {/* 같은 이름이 여러 명이면 번호 표시 */} + {rows.filter((r) => r.userName === row.userName).length > + 1 && ( + + ({getPhone(row.lineId)?.slice(-4)}) + + )} +
- {row?.userName} · {permissionName} + {row?.userName} + {rows.filter((r) => r.userName === row?.userName).length > + 1 && ( + + ({getPhone(row!.lineId)?.slice(-4)}) + + )} + {" · "} + {permissionName}