2017-03-12 17 views
0

我有一個使用文件突變與中繼的問題。我試圖創建一個使用的GetFiles()使用文件中繼突變的問題

Relay.Store.commitUpdate(
    new AddOrderMutation({userId: userId, medications: OrderInputTypeMedication, 
    userAddressId:userAddressId,files:files}), 
    { 
    onSuccess: (response) => OnResponseSuccess(response), 
    onFailure: (transaction,e) => console.log('transaction',transaction.getError(),'e',e), 
    }, 
); 

}突變

我總是得到一個錯誤,說 transaction TypeError: Network request failed at XMLHttpRequest.xhr.onerror (D:\ReactNative\MedexApp\node_modules\react-native\node_modules\whatwg-fetch\fetch.js:436) 雖然所有其他請求都工作良好。也沒有附加任何文件正確發送相同的突變。 這是文件["1489322712989.jpg":{filename:"1489322712989.jpg" uri:"file:///storage/emulated/0/Pictures/1489322712989.jpg"}] 陣列和它從來沒有通過提琴手發送請求或夾在web服務

回答

0

我沒有添加到文件對象(類型:「圖像/ JPG」),因此該文件對象應如下:

file ={ 
     uri: this.state.image.uri, 
     name: this.state.image.name, 
     type:'image/jpg' 
     };