<template>
  <GroupMembers />
</template>

<script>
import { withFetch } from 'inside-collection/hocs'
import { http } from '@inside-library/helpers/Http'

import Container from './GroupMembersContainer'

const fetchData = async ({ $route }) => {
  try {
    const { data } = await http.get('content/spaces', {
      fields: ['title', 'uuid', 'slug'],
      filters: { 'status:eq': 1, 'slug:eq': $route.params.slug }
    })

    return data[0]
  } catch (err) {
    throw new Error(err)
  }
}

export default {
  name: 'GroupMembersPage',
  components: { GroupMembers: withFetch(Container, { size: 'xxl' })(fetchData) }
}
</script>
