import React from "react";
import useApiHealth from "../../hooks/useApiHealth";

export default () => {
  const data = useApiHealth();
  
  if (data === null) {
    return <p>Connecting to back-end...</p>
  }
  
  const { status, version } = data;
  return status === "healthy"
    ? <p>API Version: {version}</p>
    : <p>Unable to communicate with API server! Error: {status}</p>
}
