Untitled

mail@pastecode.io avatar
unknown
typescript
2 years ago
912 B
2
Indexable
Never
import './style.scss';

import Component, { mixins } from 'vue-class-component';
import Vue from 'vue';
import { MediaService, MediaServiceSymbols } from '@/api';
import BasePage from '@/pages/base-page';
import { Media } from '@/entities';
@Component({
    template: require("./template.html")
})
export default class MediaPage extends mixins(BasePage, Vue) {

    protected mediaService!: MediaService;
    Items: Array<Media> = [];

    async mounted() {
        this.mediaService = this.GlobalService.Get<MediaService>(MediaServiceSymbols.MediaService);

		let items = await this.mediaService.List({Limit: 6});
		if (items.Success) {
			this.Items = items.Data.Items;
		}
    }
    async Create(): Promise<void> {
        let result = await this.mediaService.Create(new Media());
        if (result) {
            this.$router.push('/media/' + result.Data?.Id);
        }
    }
}