From fceb3b348debf23b44e9c6beb86cd78e9fffd60f Mon Sep 17 00:00:00 2001 From: selankon Date: Mon, 6 May 2024 09:57:51 +0200 Subject: [PATCH] chore(meshupgrade): migrate to shared state async --- .../src/meshUpgradeApi.tsx | 13 +++++++++++-- .../src/meshUpgradeQueriesKeys.tsx | 6 +----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/plugins/lime-plugin-mesh-wide-upgrade/src/meshUpgradeApi.tsx b/plugins/lime-plugin-mesh-wide-upgrade/src/meshUpgradeApi.tsx index f468c3f23..aa913fc96 100644 --- a/plugins/lime-plugin-mesh-wide-upgrade/src/meshUpgradeApi.tsx +++ b/plugins/lime-plugin-mesh-wide-upgrade/src/meshUpgradeApi.tsx @@ -1,4 +1,7 @@ -import { NodeMeshUpgradeInfo } from "plugins/lime-plugin-mesh-wide-upgrade/src/meshUpgradeTypes"; +import { + MeshWideUpgradeInfo, + NodeMeshUpgradeInfo, +} from "plugins/lime-plugin-mesh-wide-upgrade/src/meshUpgradeTypes"; import { callToRemoteNode, meshUpgradeApiCall, @@ -7,9 +10,15 @@ import { import api from "utils/uhttpd.service"; export const getMeshWideUpgradeInfo = async () => { - return api.call("shared-state", "getFromSharedState", { + const res = await api.call("shared-state-async", "get", { data_type: "mesh_wide_upgrade", }); + if (res.error) { + throw new Error( + `Error getting mesh wide upgrade info from shared state async, code error ${res.error}` + ); + } + return res.data as MeshWideUpgradeInfo; }; export const getMeshUpgradeNodeStatus = async () => { diff --git a/plugins/lime-plugin-mesh-wide-upgrade/src/meshUpgradeQueriesKeys.tsx b/plugins/lime-plugin-mesh-wide-upgrade/src/meshUpgradeQueriesKeys.tsx index 70aec91a0..dc947d179 100644 --- a/plugins/lime-plugin-mesh-wide-upgrade/src/meshUpgradeQueriesKeys.tsx +++ b/plugins/lime-plugin-mesh-wide-upgrade/src/meshUpgradeQueriesKeys.tsx @@ -5,11 +5,7 @@ interface MeshUpgradeQueryKeysProps { } const MeshUpgradeQueryKeys: MeshUpgradeQueryKeysProps = { - meshWideUpgradeInfo: [ - "shared-state", - "getFromSharedState", - "mesh_wide_upgrade", - ], + meshWideUpgradeInfo: ["shared-state-async", "get", "mesh_wide_upgrade"], getMeshUpgradeNodeStatus: ["lime-mesh-upgrade", "get_node_status"], remoteScheduleUpgrade: ["lime-mesh-upgrade", "schedule_upgrade"], remoteConfirmUpgrade: ["lime-mesh-upgrade", "confirm_boot_partition"],