<template>
  <section class="page section">
    <div
      class="
        page__wrapper
        detail__wrapper
        section-wrapper section-wrapper_extra
      "
    >
      <main class="detail__main">
        <div class="detail-main">
          <div class="detail-main__wrapper">
            <NewsContent :rawHtml="page.data.content"></NewsContent>
          </div>
        </div>
      </main>

      <aside class="detail__side">
        <WidgetLent></WidgetLent>
      </aside>
    </div>
  </section>
</template>

<script>
import NewsService from '../../services/NewsService'

export default {
  methods: {},
  async asyncData({ $axios, route, error }) {
    const page = await $axios
      .get(`https://api.amic.ru/api/v1/page/alias/${route.params.alias}`)
      .then((res) => res.data);

    if(!page){
      error({ statusCode: 404 })
    }
    return { page };
  },
};
</script>

<style lang="less" scoped>

</style>
