Advertisement
Guest User

Untitled

a guest
Apr 26th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. const uri = `${_REST_URL_}/reimbursement/testing.php`
  2.  
  3. const formData = new FormData();
  4. formData.append('nip', this.props.User.nip)
  5. formData.append('rei_id', this.props.jenisKlaim[this.state.jenis].rei_id)
  6. formData.append('tanggal_permintaan', this.state.tgl_permintaan)
  7. formData.append('jumlah_klaim', this.state.jml_klaim)
  8. formData.append('image', {
  9. uri: this.state.fileUri.replace('content','file'),
  10. type: this.state.fileType,
  11. name: this.state.fileName
  12. })
  13. formData.append('Content-Type', this.state.fileType)
  14.  
  15. fetch(uri, {
  16. method: 'POST',
  17. headers: {
  18. 'Content-Type': 'multipart/form-data',
  19. },
  20. body: formData
  21. })
  22. // .then((response) => response.json())
  23. .then((responseJson) => {
  24. console.log(responseJson)
  25. })
  26. .catch((error) => {
  27. console.log(error)
  28. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement