'use client'

import { suitableApi } from '@/api/suitable'
import { useMutation, useQueryClient } from '@tanstack/react-query'

export default function SuitableCreateBtn() {
  const queryClient = useQueryClient()

  const {
    mutate: createSuitable,
    isPending,
    error,
  } = useMutation({
    mutationFn: suitableApi.create,
    onSuccess: () => {
      queryClient.invalidateQueries({ queryKey: ['suitable-list'] })
    },
  })

  return (
    <>
      <div>
        <button className="bg-blue-500 text-white px-4 py-2 rounded-md" onClick={() => createSuitable()}>
          suitable create!!
        </button>
      </div>
    </>
  )
}
