need help to debug fileupload for a given mutation

  • Status: Pending
  • Præmier: ₹5000
  • Modtagne indlæg: 1

Konkurrence Instruktioner

I tried example ([login to view URL]) both api and app are working fine. I created my own client and tried and its not working. its sending null object to server.
What I need help in debug my client code provided as below pointing to the server([login to view URL]) and it should work
Since its sending null object so I am getting error "createReadStream is not a function" in both client and server. Would you pls help me to resolve this issue
Please find my my client code details and mutation details as follows(which need to work for a single file upload:
Here is my client .
import React from 'react';
import { useApolloClient, useMutation } from '@apollo/react-hooks'
import gql from 'graphql-tag'
const SINGLE_UPLOAD_MUTATION = gql`
mutation singleUpload($file: Upload!) {
singleUpload(file: $file) {
id
}
}
`
const UploadFile = () => {
const [uploadFile,{error}] = useMutation(SINGLE_UPLOAD_MUTATION);
const [uploadFileMutation] = useMutation(SINGLE_UPLOAD_MUTATION)
const onChange = ({
target: {
files: [file]
}
}) =>
uploadFileMutation({ variables: { file } }).then(() => {
[login to view URL]("file Uploade",file)
})
const onChangeHandle=(e)=>{
uploadFile({ variables: { file:[login to view URL][0] } })
}
return <input type="file" required onChange={onChangeHandle} />
}

export default UploadFile

Anbefalede Evner

Bedste indlæg fra denne konkurrence

Se flere indlæg

Offentlig Præciserings Opslagstavle

Ingen beskeder endnu.

Sådan kommer du i gang med konkurrencer

  • Opret din konkurrence

    Opret din konkurrence Hurtigt og nemt

  • Få tonsvis af indlæg

    Få tonsvis af indlæg Fra hele verden

  • Tildel det bedste indlæg

    Tildel det bedste indlæg Download filerne - Nemt!

Opret en Konkurrence Nu eller slut dig til os i dag!