import type { GridClient } from "@threefold/grid_client"; import type { IStore } from "../stores/currentDeployment"; import type { IProfile } from "../types/Profile"; import getGrid from "./getGrid"; export default function deploy( profile: IProfile, type: IStore["type"], name: string, deployer: (grid: GridClient) => Promise, ) { window.configs.currentDeploymentStore.deploy(type, name); return getGrid( profile, grid => { return deployer(grid) .then(res => { window.configs.balanceStore.updateBalance(); return res; }) .finally(() => { window.configs.currentDeploymentStore.clear(); }); }, type, ); }