1
0
mirror of https://github.com/home-assistant/frontend.git synced 2026-04-17 23:54:28 +01:00

Add option to delete add-on config on uninstall (#22268)

This commit is contained in:
Petar Petrov
2024-10-22 19:30:32 +03:00
committed by GitHub
parent 849cfed669
commit 54320c3dbf
3 changed files with 26 additions and 6 deletions

View File

@@ -358,21 +358,24 @@ export const restartHassioAddon = async (
export const uninstallHassioAddon = async (
hass: HomeAssistant,
slug: string
) => {
slug: string,
removeData: boolean
): Promise<void> => {
if (atLeastVersion(hass.config.version, 2021, 2, 4)) {
await hass.callWS({
type: "supervisor/api",
endpoint: `/addons/${slug}/uninstall`,
method: "post",
timeout: null,
data: { remove_config: removeData },
});
return;
}
await hass.callApi<HassioResponse<void>>(
"POST",
`hassio/addons/${slug}/uninstall`
`hassio/addons/${slug}/uninstall`,
{ remove_config: removeData }
);
};