From 6ebf3737af246a69f3ff687812bb0e4308788df6 Mon Sep 17 00:00:00 2001 From: Override-6 Date: Tue, 28 Nov 2023 20:04:01 +0100 Subject: [PATCH] apply suggestions --- front/components/editor/CourtPlayer.tsx | 7 ++----- front/views/Editor.tsx | 4 ++-- src/Api/Controller/APITacticController.php | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/front/components/editor/CourtPlayer.tsx b/front/components/editor/CourtPlayer.tsx index 22e1bbe..12083d3 100644 --- a/front/components/editor/CourtPlayer.tsx +++ b/front/components/editor/CourtPlayer.tsx @@ -24,8 +24,8 @@ export default function CourtPlayer({ }: PlayerProps) { const pieceRef = useRef(null) - const [x, setX] = useState(player.rightRatio) - const [y, setY] = useState(player.bottomRatio) + const x = player.rightRatio + const y = player.bottomRatio return ( { onNameChange(new_name).then((success) => { - success ? setStyle({}) : setStyle(ERROR_STYLE) + setStyle(success ? {} : ERROR_STYLE) }) }} /> @@ -239,7 +239,7 @@ function useContentState( } return state }) - }, []) + }, [saveStateCallback]) return [content, setContentSynced, savingState] } diff --git a/src/Api/Controller/APITacticController.php b/src/Api/Controller/APITacticController.php index 51ca531..79e766c 100644 --- a/src/Api/Controller/APITacticController.php +++ b/src/Api/Controller/APITacticController.php @@ -57,7 +57,7 @@ class APITacticController { "content" => [], ], function (HttpRequest $req) use ($id) { if ($fail = $this->model->updateContent($id, json_encode($req["content"]))) { - return new JsonHttpResponse([$fail]); + return new JsonHttpResponse([$fail], HttpCodes::BAD_REQUEST); } return HttpResponse::fromCode(HttpCodes::OK); });