Skip to content

Commit 4fafa16

Browse files
authored
[switch-to-payg] Fix cancellation call for TS2 (#16736)
1 parent fff9b77 commit 4fafa16

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

components/dashboard/src/SwitchToPAYG.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,16 +352,27 @@ function SwitchToPAYG() {
352352
});
353353
break;
354354

355-
case "teamSubscription2":
355+
case "teamSubscription2": {
356+
let teamId;
357+
const parsed = attributionId && AttributionId.parse(attributionId);
358+
if (parsed && parsed.kind === "team") {
359+
teamId = parsed.teamId;
360+
}
361+
if (!teamId) {
362+
// this should never be the case, but we need to re-parse the attribution id.
363+
alert("Missing Organization ID.");
364+
break;
365+
}
356366
getGitpodService()
357-
.server.cancelTeamSubscription(oldSubscriptionId)
367+
.server.cancelTeamSubscription(teamId)
358368
.catch((error) => {
359369
console.error(
360370
"Failed to cancel old subscription. We should take care of that async.",
361371
error,
362372
);
363373
});
364374
break;
375+
}
365376
}
366377
setPageState((s) => ({ ...s, phase: "done" }));
367378
return;

0 commit comments

Comments
 (0)