"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var React = _interopRequireWildcard(require("react"));

var _urql = require("urql");

const query = {
  "kind": "Document",
  "definitions": [{
    "kind": "OperationDefinition",
    "operation": "query",
    "name": {
      "kind": "Name",
      "value": "IndexQuery"
    },
    "variableDefinitions": [],
    "directives": [],
    "selectionSet": {
      "kind": "SelectionSet",
      "selections": [{
        "kind": "Field",
        "name": {
          "kind": "Name",
          "value": "account"
        },
        "arguments": [],
        "directives": [],
        "selectionSet": {
          "kind": "SelectionSet",
          "selections": [{
            "kind": "Field",
            "name": {
              "kind": "Name",
              "value": "name"
            },
            "arguments": [],
            "directives": []
          }]
        }
      }]
    }
  }],
  "loc": {
    "start": 0,
    "end": 57,
    "source": {
      "body": "\n  query IndexQuery {\n    account {\n      name\n    }\n  }\n",
      "name": "GraphQL request",
      "locationOffset": {
        "line": 1,
        "column": 1
      }
    }
  }
};

const Index = () => {
  var _res$data, _res$data$account;

  const [res] = (0, _urql.useQuery)({
    query
  });

  if (res.fetching) {
    return React.createElement("div", null, "Loading...");
  }

  if (res.error) {
    return React.createElement("div", null, "Oops");
  }

  return React.createElement("h1", null, "Yo ", ((_res$data = res.data) === null || _res$data === void 0 ? void 0 : (_res$data$account = _res$data.account) === null || _res$data$account === void 0 ? void 0 : _res$data$account.name) || "Anon");
};

var _default = Index;
exports.default = _default;