encode notice ids in notice action urls

Notice ids went into the URL raw, so a detector on a repeated device like openvino:GPU#2 had everything after the # dropped as a fragment. The acknowledge, mute, and unhide requests 404'd and the buttons did nothing. The hooks now encode the id.
This commit is contained in:
Josh Hawkins
2026-11-26 06:56:17 -06:00
parent 8eaae4b514
commit 8c773c2e2e
3 changed files with 33 additions and 23 deletions
+2 -2
View File
@@ -58,7 +58,7 @@ export function useHealthProblems(
const muteCheck = useCallback(
async (id: string) => {
await axios.post(`notices/${id}/mute`);
await axios.post(`notices/${encodeURIComponent(id)}/mute`);
mutateMutedChecks();
},
[mutateMutedChecks],
@@ -66,7 +66,7 @@ export function useHealthProblems(
const unmuteCheck = useCallback(
async (id: string) => {
await axios.delete(`notices/${id}/hidden`);
await axios.delete(`notices/${encodeURIComponent(id)}/hidden`);
mutateMutedChecks();
},
[mutateMutedChecks],
+5 -3
View File
@@ -60,15 +60,17 @@ export function useNotices(showHidden: boolean) {
);
const acknowledge = useCallback(
(id: string) => act(axios.post(`notices/${id}/acknowledge`)),
(id: string) =>
act(axios.post(`notices/${encodeURIComponent(id)}/acknowledge`)),
[act],
);
const mute = useCallback(
(id: string) => act(axios.post(`notices/${id}/mute`)),
(id: string) => act(axios.post(`notices/${encodeURIComponent(id)}/mute`)),
[act],
);
const unhide = useCallback(
(id: string) => act(axios.delete(`notices/${id}/hidden`)),
(id: string) =>
act(axios.delete(`notices/${encodeURIComponent(id)}/hidden`)),
[act],
);