Skip to content

Commit bea8e98

Browse files
committed
ascending sort for object labels
1 parent 1f0a0b9 commit bea8e98

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/stores/objectTypes.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { defineStore } from "pinia";
22
import GraphClient from "@/lib/GraphClient/GraphClient.js";
33
import objectTypesQuery from "@/lib/GraphClient/queries/getObjectTypes.json";
4+
import { orderBy } from "lodash";
45

56
const CLIENT = new GraphClient();
67

@@ -17,9 +18,14 @@ export const useObjectTypesStore = defineStore("objectTypes", {
1718
response["objectTypes"].records &&
1819
response["objectTypes"].records.length
1920
) {
20-
const objectTypesList = response["objectTypes"].records.map(
21-
({ label }) => label,
21+
//Sort the object types alphabetically
22+
let objectTypesList = orderBy(
23+
response["objectTypes"].records,
24+
["label"],
25+
["asc"],
2226
);
27+
28+
objectTypesList = objectTypesList.map(({ label }) => label);
2329
this.objectTypes = objectTypesList;
2430
}
2531

0 commit comments

Comments
 (0)