<template>
  <template-editor v-model="lp" />
</template>

<script>
import TemplateEditor from '@/components/TemplateEditor/TemplateEditor.vue'

export default {
  layout: 'admin',
  components: { TemplateEditor },
  data: () => ({
    doc: {},
    lp: []
  }),
  mounted () {
    this.$store.commit('admin/ui/setBreadcrumbs', [
      { text: 'Admin', to: '/admin' },
      { text: 'Landing Page', to: '/admin/landingpage' },
      { text: 'Edit', to: `/admin/landingpage/${this.$route.params.id}` }
    ])
    this.getDoc()
  },
  methods: {
    getDoc () {
      this.$axios.get(`/cloud/api/landingpages/${this.$route.params.id}`)
        .then((res) => {
          this.doc = res.data.data
          this.$store.commit('admin/ui/setTitle', this.doc.name)
        })
    }
  }
}
</script>
