cannot save server response into vue data

81 Views Asked by At
<template>
  <div class="file-import">
    <file-pond
      name="files"
      credits=""
      label-idle="<span class='filepond--label-action'>file</span>"
      accepted-file-types="image/jpeg, image/png"
      :allow-multiple="true"
      server= "http://localhost:3000/upload"
      v-on:init="handleFilePondInit"
      >
    </file-pond>
    <button @click="printthis"> hi </button>

  </div>
</template>
<script>

setOptions({
  server: {
    url: 'http://localhost:3000/',
    process: {
      url: './upload',
      method: 'POST',
      withCredentials: false,
      timeout: 7000,
      onload: (response) => {
        //console.log(JSON.parse(response));
       
      },
      onerror: null
    },
  }
})

  data () {
    return {
      fileList: [],
    }
  },

I was trying to save response in setOptions into fileList. Yet, if I cannot find a way to do so. If I directly set fileList = response or fileList.push(response), the code does not recognize fileList in setOptions method. Is there a way to save response into fileList? Thank you in advance!

0

There are 0 best solutions below