[dataset page][m]: setup dataset page to work with Apollo client connected to CKAN API.

This commit is contained in:
anuveyatsu
2020-06-23 14:07:49 +06:00
parent 1240eb8170
commit 2589ecaeeb
6 changed files with 64 additions and 18 deletions

View File

@@ -4,10 +4,12 @@ import { useQuery } from '@apollo/react-hooks';
import gql from 'graphql-tag';
export const GET_DATAPACKAGE_QUERY = gql`
query dataset($id: String!) {
dataset(id: $id) {
query dataset($id: String) {
dataset(id: $id) @rest(type: "Response", path: "package_show?{args}") {
result {
name
title
size
metadata_created
metadata_modified
resources {

View File

@@ -5,8 +5,8 @@ import { useQuery } from '@apollo/react-hooks';
import gql from 'graphql-tag';
export const GET_ORG_QUERY = gql`
query dataset($id: String!) {
dataset(id: $id) {
query dataset($id: String) {
dataset(id: $id) @rest(type: "Response", path: "package_show?{args}") {
result {
organization {
name

View File

@@ -4,9 +4,9 @@ import { NetworkStatus } from 'apollo-client';
import { useQuery } from '@apollo/react-hooks';
import gql from 'graphql-tag';
export const DEFAULT_DATASET_QUERY = gql`
query dataset($id: String!) {
dataset(id: $id) {
export const GET_DATAPACKAGE_QUERY = gql`
query dataset($id: String) {
dataset(id: $id) @rest(type: "Response", path: "package_show?{args}") {
result {
name
resources {
@@ -23,7 +23,7 @@ export const DEFAULT_DATASET_QUERY = gql`
export default function Resources({ variables }) {
const { loading, error, data, fetchMore, networkStatus } = useQuery(
DEFAULT_DATASET_QUERY,
GET_DATAPACKAGE_QUERY,
{
variables,
// Setting this value to true will make the component rerender when