frontend work

This commit is contained in:
peter
2020-02-09 21:03:07 +01:00
parent ac2a82ffd2
commit 776c8c320b
2 changed files with 14 additions and 7 deletions
@@ -36,15 +36,15 @@ status="control">
<br /> <br />
<br /> <br />
<h3>Gear of the last two reported kills <a target="_blank" *ngIf="dataLink != null && dataLink != ''" style="size: 0.5em;" [href]="dataLink">(data)</a></h3> <h3>Gear of the last two reported kills <a target="_blank" *ngIf="dataLink != null && dataLink != ''" style="size: 0.5em;" [href]="dataLink">(data)</a></h3>
<h5>{{boss2.name}} {{boss2.date | date : 'MMM d @ HH : mm'}}</h5>
<ng-container *ngFor="let item of gear2">
<wowhead [item]="item"></wowhead><br />
</ng-container>
<h5>{{boss1.name}} {{boss1.date | date : 'MMM d @ HH : mm'}}</h5> <h5>{{boss1.name}} {{boss1.date | date : 'MMM d @ HH : mm'}}</h5>
<ng-container *ngFor="let item of gear1"> <ng-container *ngFor="let item of gear1">
<wowhead [item]="item"></wowhead><br /> <wowhead [item]="item"></wowhead><br />
</ng-container> </ng-container>
<h5>{{boss2.name}} {{boss2.date | date : 'MMM d @ HH : mm'}}</h5>
<ng-container *ngFor="let item of gear2">
<wowhead [item]="item"></wowhead><br />
</ng-container>
</nb-card-body> </nb-card-body>
</nb-card> </nb-card>
@@ -48,8 +48,10 @@ export class FrontcraftCharacterComponent implements OnInit{
this.dataLink = "https://classic.warcraftlogs.com:443/v1/parses/character/"+this.char.charactername.replace(/^\w/, c => c.toUpperCase())+"/Gandling/EU?api_key=c698515ab4f592cdb848d80b3abe616c&metric=dps" this.dataLink = "https://classic.warcraftlogs.com:443/v1/parses/character/"+this.char.charactername.replace(/^\w/, c => c.toUpperCase())+"/Gandling/EU?api_key=c698515ab4f592cdb848d80b3abe616c&metric=dps"
fetch(this.dataLink).then(raw => raw.json().then((json) => { fetch(this.dataLink).then(raw => raw.json().then((json) => {
if(json.length > 0) return if(json.length < 1) return
const data = json[0] const data = json[0]
this.boss2 = { this.boss2 = {
@@ -65,13 +67,18 @@ export class FrontcraftCharacterComponent implements OnInit{
})) }))
fetch(this.dataLink).then(raw => raw.json().then((json) => { fetch(this.dataLink).then(raw => raw.json().then((json) => {
if(json.length > 1) return if(json.length < 2) return
console.log(json);
const data = json[1] const data = json[1]
this.boss1 = { this.boss1 = {
name: data.encounterName, name: data.encounterName,
date: data.startTime date: data.startTime
} }
this.gear2 = data.gear.map(item => {return <Item>{ this.gear2 = data.gear.map(item => {return <Item>{
itemname: item.name, itemname: item.name,
iconname: item.icon.replace('.jpg', ''), iconname: item.icon.replace('.jpg', ''),