export function useBoardChannels() {
  const channels = useState('board.channels', () => [])

  async function fetchChannels() {
    const result = await $fetch('/api/board/channels')
    channels.value = result?.channels || []
    return channels.value
  }

  function slackUrl(channelId) {
    return `https://gammaspace.slack.com/archives/${channelId}`
  }

  return {
    channels: readonly(channels),
    fetchChannels,
    slackUrl,
  }
}
