mirror of
https://github.com/home-assistant/frontend.git
synced 2026-05-01 14:13:00 +01:00
Show supervisor addon configuration error (#8950)
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
@@ -2,7 +2,11 @@ import { atLeastVersion } from "../../common/config/version";
|
||||
import { HaFormSchema } from "../../components/ha-form/ha-form";
|
||||
import { HomeAssistant } from "../../types";
|
||||
import { SupervisorArch } from "../supervisor/supervisor";
|
||||
import { hassioApiResultExtractor, HassioResponse } from "./common";
|
||||
import {
|
||||
extractApiErrorMessage,
|
||||
hassioApiResultExtractor,
|
||||
HassioResponse,
|
||||
} from "./common";
|
||||
|
||||
export type AddonStage = "stable" | "experimental" | "deprecated";
|
||||
export type AddonAppArmour = "disable" | "default" | "profile";
|
||||
@@ -186,16 +190,20 @@ export const setHassioAddonOption = async (
|
||||
data: HassioAddonSetOptionParams
|
||||
) => {
|
||||
if (atLeastVersion(hass.config.version, 2021, 2, 4)) {
|
||||
await hass.callWS({
|
||||
const response = await hass.callWS<HassioResponse<any>>({
|
||||
type: "supervisor/api",
|
||||
endpoint: `/addons/${slug}/options`,
|
||||
method: "post",
|
||||
data,
|
||||
});
|
||||
return;
|
||||
|
||||
if (response.result === "error") {
|
||||
throw Error(extractApiErrorMessage(response));
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
await hass.callApi<HassioResponse<void>>(
|
||||
return hass.callApi<HassioResponse<any>>(
|
||||
"POST",
|
||||
`hassio/addons/${slug}/options`,
|
||||
data
|
||||
|
||||
Reference in New Issue
Block a user