import { useState } from "react";
import * as prismic from "@prismicio/client";
var getClient = function getClient() {
  return prismic.createClient("https://netdata-news.cdn.prismic.io/api/v2");
};
export default (function () {
  var _useState = useState(getClient),
    client = _useState[0];
  return function (app, onSuccess, onError) {
    return client.get({
      filters: [prismic.filter.any("document.tags", Array.isArray(app) ? app : [app])],
      pageSize: 100,
      orderings: [{
        field: "document.last_publication_date",
        direction: "desc"
      }]
    }).then(onSuccess)["catch"](onError);
  };
});