<template>
  <div class="preview">
    <div class="loader" v-if="!isLoaded">
      <v-progress-circular indeterminate></v-progress-circular>
    </div>
    <VideoArticle v-else :videoItem="videoItem" />
  </div>
</template>

<script>
export default {
  data() {
    return {
      isLoaded: false,
      videoItem: null,
    };
  },

  colorMode: 'dark',

  async mounted() {
    const uuid = this.$route.query.uuid;

    if(uuid) {
      let response = await this.$axios.get(`admin/news/preview/${uuid}`);
      this.videoItem = response.data.data
    }

    else {
      this.videoItem = JSON.parse(window.localStorage.getItem("preview"))
    }

    if (this.videoItem) this.isLoaded = true;
  },
};
</script>

<style lang="less" scoped>
.loader {
  text-align: center;
  padding: 50px 0;
}
</style>>

