fix complaints/violations/matches statistick
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "no-copy-frontend",
|
"name": "no-copy-frontend",
|
||||||
"version": "0.117.0",
|
"version": "0.118.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev -p 2999",
|
"dev": "next dev -p 2999",
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ export default async function Page({
|
|||||||
>
|
>
|
||||||
<FilePageFileInfo fileInfo={fileInfo} />
|
<FilePageFileInfo fileInfo={fileInfo} />
|
||||||
{/* <FilePageActions /> */}
|
{/* <FilePageActions /> */}
|
||||||
<ViolationPpageFileStatistic />
|
<ViolationPpageFileStatistic id={id} />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<FilePageViolationsList
|
<FilePageViolationsList
|
||||||
|
|||||||
@@ -209,8 +209,9 @@ export async function fetchViolationAnalyticStatistic(group: 'domain' | 'tld') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function fetchViolationStatistic() {
|
export async function fetchViolationStatistic(id: string) {
|
||||||
const token = await getSessionData('token');
|
const token = await getSessionData('token');
|
||||||
|
console.log(`fileId => ${id}`)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${API_BASE_URL}/api/v1/data`, {
|
const response = await fetch(`${API_BASE_URL}/api/v1/data`, {
|
||||||
@@ -220,6 +221,7 @@ export async function fetchViolationStatistic() {
|
|||||||
msg_id: 30010,
|
msg_id: 30010,
|
||||||
message_body: {
|
message_body: {
|
||||||
token: token,
|
token: token,
|
||||||
|
file_id: id
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
@@ -230,6 +232,7 @@ export async function fetchViolationStatistic() {
|
|||||||
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
let parsed = await response.json();
|
let parsed = await response.json();
|
||||||
|
console.log(parsed);
|
||||||
|
|
||||||
if (parsed?.message_body) {
|
if (parsed?.message_body) {
|
||||||
return parsed?.message_body;
|
return parsed?.message_body;
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ export interface UseViolationStatistic {
|
|||||||
total_law_cases: number
|
total_law_cases: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useViolationStatistic = () => {
|
export const useViolationStatistic = (id: string) => {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: ['violationStatistic'],
|
queryKey: ['violationStatistic'],
|
||||||
queryFn: () => {
|
queryFn: () => {
|
||||||
return fetchViolationStatistic()
|
return fetchViolationStatistic(id)
|
||||||
},
|
},
|
||||||
select: (data: UseViolationStatistic | null) => {
|
select: (data: UseViolationStatistic | null) => {
|
||||||
if (!data) {
|
if (!data) {
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
import { useViolationStatistic } from '@/app/hooks/react-query/useViolationStatistic';
|
import { useViolationStatistic } from '@/app/hooks/react-query/useViolationStatistic';
|
||||||
|
|
||||||
export default function FilePpageFileStatistic() {
|
export default function FilePageFileStatistic({ id }: { id: string }) {
|
||||||
const { data: violationStatistic } = useViolationStatistic();
|
const { data: violationStatistic } = useViolationStatistic(id);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@@ -30,7 +30,7 @@ export default function FilePpageFileStatistic() {
|
|||||||
className="stat-mini-value"
|
className="stat-mini-value"
|
||||||
style={{ 'color': '#d97706' }}
|
style={{ 'color': '#d97706' }}
|
||||||
>
|
>
|
||||||
{(violationStatistic?.in_progress_violations ? violationStatistic?.in_progress_violations : 0) + (violationStatistic?.in_progress_violations ? violationStatistic?.total_law_cases : 0)}
|
{violationStatistic?.in_progress_violations ? violationStatistic?.in_progress_violations : 0}
|
||||||
</div>
|
</div>
|
||||||
<div className="stat-mini-label">В работе</div>
|
<div className="stat-mini-label">В работе</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user