42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import { Component } from '@angular/core';
|
|
import { TagListEntry } from 'src/app/model/TagListEntry';
|
|
import { VideoListEntry } from 'src/app/model/VideoListEntry';
|
|
import { RequestService } from 'src/app/request.service';
|
|
import { OnReadListModel } from 'src/app/shared/components/video-list/video-list.component';
|
|
|
|
@Component({
|
|
selector: 'app-home',
|
|
templateUrl: './home.component.html',
|
|
styleUrls: ['./home.component.scss'],
|
|
})
|
|
export class HomeComponent {
|
|
total: number = 0;
|
|
videos: VideoListEntry[] = [];
|
|
tags: TagListEntry[] = [];
|
|
|
|
constructor(public requestService: RequestService) {
|
|
this.readTagList();
|
|
}
|
|
|
|
readList(model: OnReadListModel): void {
|
|
this.requestService.post(
|
|
'video-list/read-list',
|
|
{
|
|
query: model.query,
|
|
page: model.page,
|
|
perPage: model.perPage,
|
|
},
|
|
(response: any) => {
|
|
this.videos = response.items;
|
|
this.total = response.total;
|
|
}
|
|
);
|
|
}
|
|
|
|
readTagList(): void {
|
|
this.requestService.post('tag-list/read-list', {}, (response: any) => {
|
|
this.tags = response.items;
|
|
});
|
|
}
|
|
}
|