fix(tui): silence org fetch warnings in switcher
This commit is contained in:
parent
d0ef2b2ade
commit
fa92f0590c
2 changed files with 20 additions and 1 deletions
|
|
@ -438,6 +438,10 @@ export namespace Account {
|
||||||
return Option.getOrUndefined(await runPromise((service) => service.active()))
|
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> {
|
export async function activeOrg(): Promise<ActiveOrg | undefined> {
|
||||||
return Option.getOrUndefined(await runPromise((service) => service.activeOrg()))
|
return Option.getOrUndefined(await runPromise((service) => service.activeOrg()))
|
||||||
}
|
}
|
||||||
|
|
@ -446,6 +450,10 @@ export namespace Account {
|
||||||
return runPromise((service) => service.orgsByAccount())
|
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) {
|
export async function switchOrg(accountID: AccountID, orgID: OrgID) {
|
||||||
return runPromise((service) => service.use(accountID, Option.some(orgID)))
|
return runPromise((service) => service.use(accountID, Option.some(orgID)))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,18 @@ export const ExperimentalRoutes = lazy(() =>
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
async (c) => {
|
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) =>
|
const orgs = groups.flatMap((group) =>
|
||||||
group.orgs.map((org) => ({
|
group.orgs.map((org) => ({
|
||||||
accountID: group.account.id,
|
accountID: group.account.id,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue