Skip to content

Commit

Permalink
Merge pull request #2719 from threefoldtech/development_node_validation
Browse files Browse the repository at this point in the history
Fix nodes contract in grace period toast
  • Loading branch information
samaradel authored May 20, 2024
2 parents cb47e59 + 4a42305 commit 5408573
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/playground/src/utils/nodeSelector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import type {
SelectionDetailsFilters,
SelectionDetailsFiltersValidators,
} from "../types/nodeSelector";
import { createCustomToast, ToastType } from "./custom_toast";
import { normalizeError } from "./helpers";

export interface GetLocationsConfig {
Expand Down Expand Up @@ -219,9 +220,14 @@ export async function validateRentContract(

try {
if (node.rentContractId !== 0) {
const contractInfo = await gridStore.grid.contracts.get({ id: node.rentContractId });
const contractInfo = await gridStore.grid.contracts.get({
id: node.rentContractId,
});
if (contractInfo.state.gracePeriod) {
throw `You can't deploy on node ${node.nodeId}, its rent contract is in grace period.`;
createCustomToast(
`You can't deploy on node ${node.nodeId}, its rent contract is in grace period.`,
ToastType.danger,
);
}
}

Expand Down

0 comments on commit 5408573

Please sign in to comment.