@@ -14,7 +14,7 @@ import { useEffect, useMemo } from "react";
1414import { ActionButtonGroup } from "@/components/action-button-group" ;
1515import { HeaderButtonGroup } from "@/components/header-button-group" ;
1616import { toast } from "sonner" ;
17- import { ModelWAF , wafBlockReasons } from "@/types" ;
17+ import { ModelWAFApiMock , wafBlockReasons } from "@/types" ;
1818import { deleteWAF } from "@/api/waf" ;
1919import { ip16Str } from "@/lib/utils" ;
2020import { SettingsTab } from "@/components/settings-tab" ;
@@ -23,7 +23,7 @@ import { useTranslation } from "react-i18next";
2323
2424export default function WAFPage ( ) {
2525 const { t } = useTranslation ( ) ;
26- const { data, mutate, error, isLoading } = useSWR < ModelWAF [ ] > ( "/api/v1/waf" , swrFetcher ) ;
26+ const { data, mutate, error, isLoading } = useSWR < ModelWAFApiMock [ ] > ( "/api/v1/waf" , swrFetcher ) ;
2727
2828 useEffect ( ( ) => {
2929 if ( error )
@@ -33,7 +33,7 @@ export default function WAFPage() {
3333 // eslint-disable-next-line react-hooks/exhaustive-deps
3434 } , [ error ] ) ;
3535
36- const columns : ColumnDef < ModelWAF > [ ] = [
36+ const columns : ColumnDef < ModelWAFApiMock > [ ] = [
3737 {
3838 id : "select" ,
3939 header : ( { table } ) => (
@@ -59,7 +59,7 @@ export default function WAFPage() {
5959 {
6060 header : "IP" ,
6161 accessorKey : "ip" ,
62- accessorFn : ( row ) => ip16Str ( row . ip ?? [ ] ) ,
62+ accessorFn : ( row ) => ip16Str ( row . ip ?? "" ) ,
6363 } ,
6464 {
6565 header : t ( "Count" ) ,
@@ -78,7 +78,7 @@ export default function WAFPage() {
7878 accessorFn : ( row ) => row . last_block_timestamp ,
7979 cell : ( { row } ) => {
8080 const s = row . original ;
81- const date = new Date ( s . last_block_timestamp || 0 ) ;
81+ const date = new Date ( ( s . last_block_timestamp || 0 ) * 1000 ) ;
8282 return < span > { date . toISOString ( ) } </ span > ;
8383 } ,
8484 } ,
@@ -92,7 +92,7 @@ export default function WAFPage() {
9292 className = "flex gap-2"
9393 delete = { {
9494 fn : deleteWAF ,
95- id : ip16Str ( s . ip ?? [ ] ) ,
95+ id : ip16Str ( s . ip ?? "" ) ,
9696 mutate : mutate ,
9797 } }
9898 >
@@ -123,7 +123,7 @@ export default function WAFPage() {
123123 className = "flex-2 flex gap-2 ml-auto"
124124 delete = { {
125125 fn : deleteWAF ,
126- id : selectedRows . map ( ( r ) => ip16Str ( r . original . ip ?? [ ] ) ) ,
126+ id : selectedRows . map ( ( r ) => ip16Str ( r . original . ip ?? "" ) ) ,
127127 mutate : mutate ,
128128 } }
129129 >
0 commit comments