Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
upload() {
this.setState({
uploading: true,
location: locationFactory('/hidden'),
})
// This is an upload specific apollo client to record progress
// Uses XHR since Fetch does not provide the required interface
const uploadClient = getClient(
`${config.url}/crn/graphql`,
null,
xhrFetch(this),
)
if (this.state.resume) {
// Diff and add files
} else {
let client = this.props.client
// Create dataset and then add files
mutation
.createDataset(client)(this.state.name)
.then(datasetId => {
mutation
.updateFiles(uploadClient)(datasetId, this.state.files)
.then(() => {
this.setState({ datasetId })
import getClient from 'openneuro-client'
import {datasets, files} from 'openneuro-client'
import gql from 'graphql-tag'
import bids from './bids'
import clone from 'lodash.clonedeep'
import request from './request'
import config from '../../../config'
const URI = config.datalad.uri
const client = getClient('/crn/graphql')
export default {
async getDatasets(options) {
const query = datasets.getDatasets
return new Promise((resolve, reject) => {
client.query({
query: query
})
.then(data => {
data = clone(data)
let datasets = data.data.datasets
if (options.isPublic) {
datasets = data.data.datasets.filter((dataset) => {
return dataset.public
})
}
data.data.datasets = datasets
export const configuredClient = () =>
createClient(`${getUrl()}crn/graphql`, getToken)