Skip to content

Commit

Permalink
fix(item): return unknown mimetype if the value is null
Browse files Browse the repository at this point in the history
This happen if the element isn't downloaded yet
  • Loading branch information
davinkevin committed Feb 23, 2018
1 parent cad0fe7 commit 93aa70b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion frontend-angular/src/app/item/item.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</div>
</mat-toolbar>

<div [ngSwitch]="mediaType()">
<div [ngSwitch]="mediaType">

<div *ngSwitchCase="'video'">
<div class="item__cover" [ngStyle]="{'background-image': 'url(' + item.cover.url + ')' }" (click)="togglePlayer()" *ngIf="!showPlayer">
Expand Down
8 changes: 6 additions & 2 deletions frontend-angular/src/app/item/item.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,13 @@ export class ItemComponent implements OnInit, OnDestroy {
this.showPlayer = !this.showPlayer;
}

mediaType() {
return this.item.mimeType.substr(0, this.item.mimeType.indexOf('/'));
get mediaType() {
console.log(this.item.mimeType);
if (this.item.mimeType == null) {
return 'unknown';
}

return this.item.mimeType.substr(0, this.item.mimeType.indexOf('/'))
}

openSideNav() {
Expand Down

0 comments on commit 93aa70b

Please sign in to comment.