Skip to content

Commit

Permalink
fix sort logic, change id from string to number
Browse files Browse the repository at this point in the history
  • Loading branch information
kristianka committed Jun 6, 2024
1 parent c5d95f2 commit 1b08312
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions frontend/src/components/Buttons/sortLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ export const sortBoxes = (boxes: Box[], sort: SortType) => {
new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime()
);
case "idAscending":
return a.id.localeCompare(b.id);
return a.id - b.id;
case "idDescending":
return b.id.localeCompare(a.id);
return b.id - a.id;
default:
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export interface Box {
id: string;
id: number;
width: number;
height: number;
depth: number;
Expand Down

0 comments on commit 1b08312

Please sign in to comment.