eleven-solutions-common-website-unique-web 6.0.26 → 6.0.27

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,11 +13,30 @@ import { FaPlus } from "react-icons/fa";
13
13
  import { fetchTaxonomiessApi } from "../api/taxonomy";
14
14
  const Taxionomies = () => {
15
15
  const [taxonomy, setTaxonomy] = useState([]);
16
+ // const fetchTaxonomiesData = async () => {
17
+ // const data = await fetchTaxonomiessApi();
18
+ // if (data) {
19
+ // const uniqueTaxonomies = (data as any[]).reduce(
20
+ // (acc: any[], item: any) => {
21
+ // if (!acc.some((taxonomy) => taxonomy.type === item.type)) {
22
+ // acc.push(item);
23
+ // }
24
+ // return acc;
25
+ // },
26
+ // []
27
+ // );
28
+ // setTaxonomy(uniqueTaxonomies);
29
+ // } else {
30
+ // console.error("Failed to fetch taxonomies");
31
+ // }
32
+ // };
16
33
  const fetchTaxonomiesData = () => __awaiter(void 0, void 0, void 0, function* () {
17
34
  const data = yield fetchTaxonomiessApi();
18
35
  if (data) {
19
36
  const uniqueTaxonomies = data.reduce((acc, item) => {
20
- if (!acc.some((taxonomy) => taxonomy.type === item.type)) {
37
+ // Check if the taxonomy has no parentId and is unique by type
38
+ if (!item.parentId &&
39
+ !acc.some((taxonomy) => taxonomy.type === item.type)) {
21
40
  acc.push(item);
22
41
  }
23
42
  return acc;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eleven-solutions-common-website-unique-web",
3
- "version": "6.0.26",
3
+ "version": "6.0.27",
4
4
  "main": "./dist/index.js",
5
5
  "scripts": {
6
6
  "build": "tsc",
@@ -7,12 +7,34 @@ import { fetchTaxonomiessApi } from "../api/taxonomy";
7
7
  const Taxionomies = () => {
8
8
  const [taxonomy, setTaxonomy] = useState<any[]>([]);
9
9
 
10
+ // const fetchTaxonomiesData = async () => {
11
+ // const data = await fetchTaxonomiessApi();
12
+ // if (data) {
13
+ // const uniqueTaxonomies = (data as any[]).reduce(
14
+ // (acc: any[], item: any) => {
15
+ // if (!acc.some((taxonomy) => taxonomy.type === item.type)) {
16
+ // acc.push(item);
17
+ // }
18
+ // return acc;
19
+ // },
20
+ // []
21
+ // );
22
+
23
+ // setTaxonomy(uniqueTaxonomies);
24
+ // } else {
25
+ // console.error("Failed to fetch taxonomies");
26
+ // }
27
+ // };
10
28
  const fetchTaxonomiesData = async () => {
11
29
  const data = await fetchTaxonomiessApi();
12
30
  if (data) {
13
31
  const uniqueTaxonomies = (data as any[]).reduce(
14
32
  (acc: any[], item: any) => {
15
- if (!acc.some((taxonomy) => taxonomy.type === item.type)) {
33
+ // Check if the taxonomy has no parentId and is unique by type
34
+ if (
35
+ !item.parentId &&
36
+ !acc.some((taxonomy) => taxonomy.type === item.type)
37
+ ) {
16
38
  acc.push(item);
17
39
  }
18
40
  return acc;