Skip to content

Commit 4f421ef

Browse files
committed
Auto-provision free seat on auth init if none exists
1 parent 8bb4e31 commit 4f421ef

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

apps/code/src/renderer/features/billing/stores/seatStore.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,11 @@ export const useSeatStore = create<SeatStore>()(
124124
set({ isLoading: true, error: null, redirectUrl: null });
125125
try {
126126
const client = getClient();
127-
const seat = await client.getMySeat();
127+
let seat = await client.getMySeat();
128+
if (!seat) {
129+
log.info("No seat found, auto-provisioning free plan");
130+
seat = await client.createSeat(PLAN_FREE);
131+
}
128132
set({ seat, isLoading: false });
129133
} catch (error) {
130134
handleSeatError(error, set);

0 commit comments

Comments
 (0)