Publish finished reviews to mqtt / ws and use that for source of update banner (#10072)

* Add reviews to frontend

* Update ready when new review is saved

* fix

* Formatting
This commit is contained in:
Nicolas Mowen
2024-02-27 06:37:39 -07:00
committed by GitHub
parent 00c2caa1b7
commit f95ce913b1
6 changed files with 53 additions and 15 deletions

View File

@@ -10,7 +10,7 @@ import {
import { produce, Draft } from "immer";
import useWebSocket, { ReadyState } from "react-use-websocket";
import { FrigateConfig } from "@/types/frigateConfig";
import { FrigateEvent, ToggleableSetting } from "@/types/ws";
import { FrigateEvent, FrigateReview, ToggleableSetting } from "@/types/ws";
import { FrigateStats } from "@/types/stats";
type ReducerState = {
@@ -218,7 +218,14 @@ export function useRestart(): {
export function useFrigateEvents(): { payload: FrigateEvent } {
const {
value: { payload },
} = useWs(`events`, "");
} = useWs("events", "");
return { payload };
}
export function useFrigateReviews(): { payload: FrigateReview } {
const {
value: { payload },
} = useWs("reviews", "");
return { payload };
}