From e8033f0bbc6dd43b618d6daadf7bfd4e01921f30 Mon Sep 17 00:00:00 2001 From: Steve Faulkner Date: Tue, 13 Apr 2021 18:53:59 -0500 Subject: [PATCH] Alpha sort subscriptions and accounts in dropdown (#663) --- src/hooks/useDatabaseAccounts.tsx | 2 +- src/hooks/useSubscriptions.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hooks/useDatabaseAccounts.tsx b/src/hooks/useDatabaseAccounts.tsx index 513266b50..97ced2799 100644 --- a/src/hooks/useDatabaseAccounts.tsx +++ b/src/hooks/useDatabaseAccounts.tsx @@ -26,7 +26,7 @@ export async function fetchDatabaseAccounts(subscriptionId: string, accessToken: nextLink = result.nextLink; accounts = [...accounts, ...result.value]; } - return accounts; + return accounts.sort((a, b) => a.name.localeCompare(b.name)); } export function useDatabaseAccounts(subscriptionId: string, armToken: string): DatabaseAccount[] | undefined { diff --git a/src/hooks/useSubscriptions.tsx b/src/hooks/useSubscriptions.tsx index 954a2539b..d7ebfcbe3 100644 --- a/src/hooks/useSubscriptions.tsx +++ b/src/hooks/useSubscriptions.tsx @@ -1,5 +1,5 @@ -import { Subscription } from "../Contracts/DataModels"; import useSWR from "swr"; +import { Subscription } from "../Contracts/DataModels"; interface SubscriptionListResult { nextLink: string; @@ -28,7 +28,7 @@ export async function fetchSubscriptions(accessToken: string): Promise a.displayName.localeCompare(b.displayName)); } export function useSubscriptions(armToken: string): Subscription[] | undefined {