import {ShopActions} from '@shopify/shop-minis-platform/actions'

import {useShopActions} from '../../internal/useShopActions'

interface UseErrorToastReturns {
  /**
   * Show an error toast with the given error message.
   */
  showErrorToast: ShopActions['showErrorToast']
}

export const useErrorToast = (): UseErrorToastReturns => {
  const {showErrorToast} = useShopActions()

  return {showErrorToast}
}
