FrontEnd/src/index.ts

75 lines
1.8 KiB
TypeScript
Raw Normal View History

import Vue from "vue";
import VGC from "./components/Video_Grid.vue";
import SCH from "./components/Search.vue";
import VTBL from "./components/Video_Table.vue";
import CTBL from "./components/Channel_Table.vue";
import CADD from "./components/Channel_Add.vue";
import './index.css';
import * as DumbYT from "./dumbyt";
let MainApp = new Vue({
el: "#app",
template: `
<div>
<SCH v-on:search_complete="search_completed"/>
<VGC v-bind:Videos="Videos"/>
</div>
`,
components: {
SCH,
VGC
},
data() {
return {
Videos: Array<DumbYT.Video>()
}
},
methods: {
// Callback for when the search component got results back.
search_completed(videos : Array<DumbYT.Video>) : void {
this.Videos = videos;
}
2018-03-31 05:09:12 +00:00
},
mounted(){
// Populate some Videos immediatly on start up.
DumbYT.API.search_videos("").then(videos => {
// Copy the videos over.
this.Videos = videos;
});
}
});
let AdminApp = new Vue({
el: "#admin_app",
template: `
<div>
<SCH v-on:search_complete="search_completed"/>
<CADD/>
<CTBL v-bind:Channels="Channels"/>
<VTBL v-bind:Videos="Videos"/>
</div>
`,
components: {
SCH,
CADD,
CTBL,
VTBL
},
data() {
return {
Videos: Array<DumbYT.Video>(),
Channels: Array<DumbYT.Channel>()
}
},
methods: {
// Callback for when the search component got results back.
search_completed(videos : Array<DumbYT.Video>) : void {
this.Videos = videos;
}
},
mounted(){
// Populate the channels field immediatly on start up.
DumbYT.API.search_channels("").then(channels => this.Channels = channels);
}
});