I am facing an issue with using await at the specified location in 1.vue file. Whenever I try to use await, it throws an error stating Unexpected reserved word 'await'
. How can I modify async useFunctionToAllServers()
to execute sequentially after [Promise.all], or should I make changes to submitToTheOthers()
? Please guide me on where to place async or suggest alterations to overcome this obstacle.
1.vue
<template>
<div>
<label for="imgUpload">
<button class="point">upload</button>
</label>
<input
type="file"
class="input-file"
ref="logo1"
id="imgUpload"
@change="sendFile('logo')"
/>
<div v-if="imageData" class="imgBox">
<img :src="imageData" />
</div>
<label for="imgUpload">
<button class="point">upload1</button>
</label>
<input
type="file"
class="input-file"
ref="logo1"
id="imgUpload"
@change="sendFile('logo1')"
/>
<div v-if="imageData1" class="imgBox">
<img :src="imageData1" />
</div>
<button @click="useFunctionToAllServers">BUTTON</button>
</div>
</template>
...
2.js
import axios from 'axios'
export const headers = {
'Content-Type': 'application/json',
'header1' : 'header1',
'header2' : 'header2',
}
export function updateGeneralInfoToOther(id, data, serverAddress) {
data.serverAddress = serverAddress
return axios.put(`/u/r/l/${id}`, data, { headers })
}
export function updateGeneralInfo(id, data) {
return axios.put(`/extra/u/r/l/${id}`, data, { headers })
}
export function createUploadToOther(data) {
return axios.post('/u/r/l', data, { headers })
}