Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions src/templates/publishers/index.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,31 @@
import React from 'react';
import axios from 'axios';
import { PublisherList } from "@civicactions/data-catalog-components";
import config from "../../assets/config";
import Layout from '../../components/Layout';
import orgs from "../../assets/publishers";

const Publishers = () => {
const { t } = useTranslation('publishers');
const [orgs, setOrgs] = React.useState(null);
const [publishers, setPublishers] = React.useState([])

React.useEffect(() => {
async function getOrgs() {
const { data } = await axios.get(`${process.env.REACT_APP_ROOT_URL}/metastore/schemas/publisher/items`)
setOrgs(data);
}
if (orgs === null) {
getOrgs();
}
if (orgs) {
const items = [];
orgs.forEach(element => {
items.push(element.data);
});
setPublishers(items);
}
}, [orgs])

return (
<Layout title="Dataset Publishers">
<div className={`dc-page ${config.container}`}>
Expand All @@ -20,7 +41,7 @@ const Publishers = () => {
publishing data to the same site.
</p>

<PublisherList items = {orgs} />
<PublisherList items = {publishers} />

</div>
</div>
Expand Down