// Extract a human-readable message from an API error. The backend nests the
// message at data.data.error.message (see error_response); older call sites read
// shallower paths, so try them all before falling back.
export function apiError(err, fallback = 'Something went wrong') {
  return err?.response?.data?.data?.error?.message
    || err?.response?.data?.error?.message
    || err?.response?.data?.message
    || fallback
}
