260508_17_ENH: 클라이언트 강력 요청으로 로그인 아예 걷고 파라미터 기반으로 admin 기능 우회
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { useSearchParams } from "next/navigation";
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
import { toast } from "sonner";
|
||||
import DataTable from "@/components/table/DataTable";
|
||||
import type { DataColumn } from "@/components/table/types";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { DIV_KEY_MAP } from "@/config/kfpaConfig";
|
||||
import { useAuth } from "@/hooks/useAuth";
|
||||
import { formatKoreanBaseDate } from "@/lib/utils";
|
||||
import { useWriteDivCommentMutation } from "@/query/admin";
|
||||
import { statisticsQueryKeys } from "@/query/key/keys";
|
||||
@@ -15,6 +15,7 @@ import { useDivDetailDataQuery } from "@/query/statistics";
|
||||
import type { CommentValue, DivDetailData } from "@/types/kfpa";
|
||||
import { Pencil, Save, X } from 'lucide-react';
|
||||
import SectionTitle from "@/components/common/SectionTitle";
|
||||
import { hasAdminRouteParam } from "@/lib/admin-route";
|
||||
|
||||
export type SafetyInspectionDivDetailProps = {
|
||||
selectedDiv: string;
|
||||
@@ -85,7 +86,7 @@ const createDraft = (columns: Array<{ key: string }>, source?: Record<string, Co
|
||||
}, {});
|
||||
|
||||
const SafetyInspectionDivDetail = ({ selectedDiv }: SafetyInspectionDivDetailProps) => {
|
||||
const { auth } = useAuth();
|
||||
const searchParams = useSearchParams();
|
||||
const queryClient = useQueryClient();
|
||||
const { data, isLoading, isError } = useDivDetailDataQuery(selectedDiv, selectedDiv !== "-1");
|
||||
const writeMutation = useWriteDivCommentMutation();
|
||||
@@ -103,7 +104,7 @@ const SafetyInspectionDivDetail = ({ selectedDiv }: SafetyInspectionDivDetailPro
|
||||
}, [commentColumns, detail?.commentValues, selectedDiv]);
|
||||
|
||||
const baseDateLabel = useMemo(() => formatKoreanBaseDate(), []);
|
||||
const isAuthenticated = auth.user != null;
|
||||
const isAuthenticated = hasAdminRouteParam(searchParams);
|
||||
|
||||
const rankRows: RankRow[] = useMemo(() => {
|
||||
const ranks = detail?.csiRanks ?? {};
|
||||
|
||||
Reference in New Issue
Block a user