fix(tui): silence org fetch warnings in switcher
parent
d0ef2b2ade
commit
fa92f0590c
|
|
@ -438,6 +438,10 @@ export namespace Account {
|
|||
return Option.getOrUndefined(await runPromise((service) => service.active()))
|
||||
}
|
||||
|
||||
export async function list(): Promise<Info[]> {
|
||||
return runPromise((service) => service.list())
|
||||
}
|
||||
|
||||
export async function activeOrg(): Promise<ActiveOrg | undefined> {
|
||||
return Option.getOrUndefined(await runPromise((service) => service.activeOrg()))
|
||||
}
|
||||
|
|
@ -446,6 +450,10 @@ export namespace Account {
|
|||
return runPromise((service) => service.orgsByAccount())
|
||||
}
|
||||
|
||||
export async function orgs(accountID: AccountID): Promise<readonly Org[]> {
|
||||
return runPromise((service) => service.orgs(accountID))
|
||||
}
|
||||
|
||||
export async function switchOrg(accountID: AccountID, orgID: OrgID) {
|
||||
return runPromise((service) => service.use(accountID, Option.some(orgID)))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,18 @@ export const ExperimentalRoutes = lazy(() =>
|
|||
},
|
||||
}),
|
||||
async (c) => {
|
||||
const [groups, active] = await Promise.all([Account.orgsByAccount(), Account.active()])
|
||||
const [accounts, active] = await Promise.all([Account.list(), Account.active()])
|
||||
const groups = await Promise.all(
|
||||
accounts.map(async (account) => {
|
||||
try {
|
||||
const orgs = await Account.orgs(account.id)
|
||||
return { account, orgs }
|
||||
} catch {
|
||||
return { account, orgs: [] }
|
||||
}
|
||||
}),
|
||||
)
|
||||
|
||||
const orgs = groups.flatMap((group) =>
|
||||
group.orgs.map((org) => ({
|
||||
accountID: group.account.id,
|
||||
|
|
|
|||
Loading…
Reference in New Issue