<template>
  <div class="player">
    <h1>{{ name }}</h1>
    <h2>{{ name }}</h2>
  </div>
</template>

<script>
  import axios from '../../plugins/axios'
  export default {
    validate ({ params }) {
      console.log(params.id);
      return !isNaN(+params.id)
    },
    async asyncData({ env, params, error}) {
      const { data } = await axios.get('/api/uccn/app/unauth/campsite/shop?id='+params.id);
      let user = data.data;
      if (!user) {
        return error({ message: 'User not found', statusCode: 404 })
      }
      return user
    },
    head () {
      return {
        title: this.name
      }
    }
  }
</script>

<style scoped>
  .player {
    text-align: center;
    margin-top: 100px;
    font-family: sans-serif;
  }
</style>
