import { Link, routes } from '@redwoodjs/router'

import Artikels from 'src/components/Artikel/Artikels'

export const QUERY = gql`
  query FindArtikels {
    artikels {
      id
      name
      preis
      kategorie {id, name}
    }
  }
`

export const Loading = () => <div>Loading...</div>

export const Empty = () => {
  return (
    <div className="rw-text-center">
      {'No artikels yet. '}
      <Link to={routes.newArtikel()} className="rw-link">
        {'Create one?'}
      </Link>
    </div>
  )
}

export const Failure = ({ error }) => (
  <div className="rw-cell-error">{error?.message}</div>
)

export const Success = ({artikels }) => {
  return <Artikels artikels={artikels}  />
}
