Skip to content

Commit

Permalink
chore(meshupgrade): migrate to shared state async
Browse files Browse the repository at this point in the history
  • Loading branch information
selankon committed May 6, 2024
1 parent a9243e8 commit fceb3b3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
13 changes: 11 additions & 2 deletions plugins/lime-plugin-mesh-wide-upgrade/src/meshUpgradeApi.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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 () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down

0 comments on commit fceb3b3

Please sign in to comment.