File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,18 +9,24 @@ const isOpen = ref(false)
99const isLoading = ref (false )
1010const orgs = ref <string []>([])
1111const hasLoaded = ref (false )
12+ const error = ref <string | null >(null )
1213
1314async function loadOrgs() {
1415 if (hasLoaded .value || isLoading .value ) return
1516
1617 isLoading .value = true
18+ error .value = null
1719 try {
1820 const orgList = await listUserOrgs ()
1921 if (orgList ) {
2022 // Already sorted alphabetically by server, take top 10
2123 orgs .value = orgList .slice (0 , 10 )
24+ } else {
25+ error .value = ' Failed to load organizations'
2226 }
2327 hasLoaded .value = true
28+ } catch {
29+ error .value = ' Failed to load organizations'
2430 } finally {
2531 isLoading .value = false
2632 }
@@ -80,6 +86,10 @@ function handleKeydown(event: KeyboardEvent) {
8086 <span class =" text-fg-muted text-sm" >Loading...</span >
8187 </div >
8288
89+ <div v-else-if =" error" class =" px-3 py-4 text-center" >
90+ <span class =" text-fg-muted text-sm" >{{ error }}</span >
91+ </div >
92+
8393 <ul v-else-if =" orgs.length > 0" class =" py-1 max-h-80 overflow-y-auto" >
8494 <li v-for =" org in orgs" :key =" org" >
8595 <NuxtLink
Original file line number Diff line number Diff line change @@ -9,18 +9,24 @@ const isOpen = ref(false)
99const isLoading = ref (false )
1010const packages = ref <string []>([])
1111const hasLoaded = ref (false )
12+ const error = ref <string | null >(null )
1213
1314async function loadPackages() {
1415 if (hasLoaded .value || isLoading .value ) return
1516
1617 isLoading .value = true
18+ error .value = null
1719 try {
1820 const pkgMap = await listUserPackages ()
1921 if (pkgMap ) {
2022 // Sort alphabetically and take top 10
2123 packages .value = Object .keys (pkgMap ).sort ().slice (0 , 10 )
24+ } else {
25+ error .value = ' Failed to load packages'
2226 }
2327 hasLoaded .value = true
28+ } catch {
29+ error .value = ' Failed to load packages'
2430 } finally {
2531 isLoading .value = false
2632 }
@@ -80,6 +86,10 @@ function handleKeydown(event: KeyboardEvent) {
8086 <span class =" text-fg-muted text-sm" >Loading...</span >
8187 </div >
8288
89+ <div v-else-if =" error" class =" px-3 py-4 text-center" >
90+ <span class =" text-fg-muted text-sm" >{{ error }}</span >
91+ </div >
92+
8393 <ul v-else-if =" packages.length > 0" class =" py-1 max-h-80 overflow-y-auto" >
8494 <li v-for =" pkg in packages" :key =" pkg" >
8595 <NuxtLink
You can’t perform that action at this time.
0 commit comments