Skip to content

Commit

Permalink
Order databases by display_order
Browse files Browse the repository at this point in the history
  • Loading branch information
leonkenneth committed Feb 10, 2025
1 parent eb1e0f6 commit 1d4f256
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions components/diffusionDatabase.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ export interface DiffusionDatabase {
is_featured: boolean;
featured_summary: string;
attributes: Attribute[];
display_order: number;
}
5 changes: 4 additions & 1 deletion utils/databases.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ export async function getDatabases(): Promise<DiffusionDatabase[]> {
const url = process.env.NEXT_PUBLIC_API_BASE + '/diffusion_databases';
const res = await fetch(url);
const data = await res.json();
return data;
return data.sort(
(a: DiffusionDatabase, b: DiffusionDatabase) =>
a.display_order - b.display_order,
);
}

0 comments on commit 1d4f256

Please sign in to comment.