peter 5 роки тому
джерело
коміт
3b7de5cf2d

+ 2
- 1
src/frontend/src/app/frontcraft/pages/armory/armory.component.ts Переглянути файл

@@ -35,7 +35,8 @@ export class FrontcraftArmoryComponent implements OnInit{
35 35
         itemname: item.name,
36 36
         iconname: item.icon.replace('.jpg', ''),
37 37
         quality: item.quality.replace(/^\w/, c => c.toUpperCase()),
38
-        url: "https://classic.wowhead.com/item="+item.id
38
+        url: "https://classic.wowhead.com/item="+item.id,
39
+        tooltip: "unavailable"
39 40
       }})
40 41
     }))
41 42
   }

+ 18
- 10
src/frontend/src/app/frontcraft/pages/character/character.component.ts Переглянути файл

@@ -25,7 +25,7 @@ export class FrontcraftCharacterComponent implements OnInit{
25 25
     gear1:string[] = []
26 26
     
27 27
     boss2= {}
28
-    gear2:Item[] = []
28
+    gear2:string[] = []
29 29
 
30 30
     constructor(
31 31
       private api: ApiService,
@@ -50,7 +50,7 @@ export class FrontcraftCharacterComponent implements OnInit{
50 50
 
51 51
           
52 52
 
53
-          fetch(this.dataLink).then(raw => raw.json().then(async (json) => {
53
+          fetch(this.dataLink).then(raw => raw.json().then((json) => {
54 54
             if(json.length < 1) return
55 55
             const data = json[0]
56 56
 
@@ -58,14 +58,18 @@ export class FrontcraftCharacterComponent implements OnInit{
58 58
               name: data.encounterName,
59 59
               date: data.startTime
60 60
             }
61
-
62
-            this.gear2 = await Promise.all(data.gear.map(i => i.name).map(itemName => this.api.get('ItemManager').getItem(itemName)))
63
-            this.gear2 = this.gear2.filter(i => i!=null)            
64
-          
61
+            this.gear2 = data.gear.map(item => {return <Item>{
62
+              itemname: item.name,
63
+              iconname: item.icon.replace('.jpg', ''),
64
+              quality: item.quality.replace(/^\w/, c => c.toUpperCase()),
65
+              url: "https://classic.wowhead.com/item="+item.id,
66
+              tooltip: "unavailable"
67
+            }}).filter(item => item.itemname != "Unknown Item")
65 68
           }))
66 69
 
67
-          fetch(this.dataLink).then(raw => raw.json().then(async (json) => {
70
+          fetch(this.dataLink).then(raw => raw.json().then((json) => {
68 71
             if(json.length < 2) return
72
+
69 73
             const data = json[1]
70 74
 
71 75
             this.boss1 = {
@@ -73,9 +77,13 @@ export class FrontcraftCharacterComponent implements OnInit{
73 77
               date: data.startTime
74 78
             }
75 79
 
76
-            
77
-            this.gear1 = await Promise.all(data.gear.map(i => i.name).map(itemName => this.api.get('ItemManager').getItem(itemName)))
78
-            this.gear1 = this.gear1.filter(i => i!=null)            
80
+            this.gear1 = data.gear.map(item => {return <Item>{
81
+              itemname: item.name,
82
+              iconname: item.icon.replace('.jpg', ''),
83
+              quality: item.quality.replace(/^\w/, c => c.toUpperCase()),
84
+              url: "https://classic.wowhead.com/item="+item.id,
85
+              tooltip: "unavailable"
86
+            }}).filter(item => item.itemname != "Unknown Item")
79 87
           }))
80 88
         }
81 89
       })

Завантаження…
Відмінити
Зберегти