+2
-1
@@ -1036,7 +1036,8 @@ let fpItems = [];
|
|||||||
|
|
||||||
async function loadFalsePositives() {
|
async function loadFalsePositives() {
|
||||||
try {
|
try {
|
||||||
fpItems = (await api('/false-positives')) || [];
|
const res = await api('/false-positives');
|
||||||
|
fpItems = res.data || res || [];
|
||||||
renderFalsePositives();
|
renderFalsePositives();
|
||||||
} catch (e) { console.error('fp load error', e); }
|
} catch (e) { console.error('fp load error', e); }
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-1
@@ -95,7 +95,7 @@ class Router
|
|||||||
=> $this->updateTelegramConfig(),
|
=> $this->updateTelegramConfig(),
|
||||||
|
|
||||||
$path === '/false-positives' && $method === 'GET'
|
$path === '/false-positives' && $method === 'GET'
|
||||||
=> $this->repo->getFalsePositives(),
|
=> $this->getFalsePositives(),
|
||||||
$path === '/false-positives' && $method === 'POST'
|
$path === '/false-positives' && $method === 'POST'
|
||||||
=> $this->createFalsePositive(),
|
=> $this->createFalsePositive(),
|
||||||
preg_match('#^/false-positives/(\d+)$#', $path, $m) && $method === 'DELETE'
|
preg_match('#^/false-positives/(\d+)$#', $path, $m) && $method === 'DELETE'
|
||||||
@@ -337,6 +337,11 @@ class Router
|
|||||||
return $this->repo->createFalsePositive($pattern, $description);
|
return $this->repo->createFalsePositive($pattern, $description);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getFalsePositives(): array
|
||||||
|
{
|
||||||
|
return ['data' => $this->repo->getFalsePositives()];
|
||||||
|
}
|
||||||
|
|
||||||
private function deleteFalsePositive(int $id): array
|
private function deleteFalsePositive(int $id): array
|
||||||
{
|
{
|
||||||
$this->repo->deleteFalsePositive($id);
|
$this->repo->deleteFalsePositive($id);
|
||||||
|
|||||||
Reference in New Issue
Block a user