Skip to content

Commit 5d7afe8

Browse files
committed
fix: post if server is not null and token available
1 parent 69994bf commit 5d7afe8

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/components/Inputs/SaveData/SaveData.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,14 @@ export default {
195195
});
196196
},
197197
sendRetry(url, formData, index, retries = 3, backoff = 10000) {
198+
if (!this.shouldUpload) {
199+
console.log("Not uploading")
200+
return;
201+
}
198202
const config1 = {
199203
'Content-Type': 'multipart/form-data'
200204
};
201-
return axios.post(`${config.backendServer}/submit`, formData, config1).then((res) => {
205+
return axios.post(url, formData, config1).then((res) => {
202206
// console.log(322, 'SUCCESS!!', `${fileName}.zip.00${index}`, res.status);
203207
slicedArray.splice(index, 1); // remove successfully POSTed slice
204208
sentPartCount++;

src/components/Survey/Survey.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,12 +490,16 @@
490490
});
491491
},
492492
async sendRetry(url, formData, retries = 3, backoff = 10000) {
493+
if (!this.shouldUpload) {
494+
console.log("Not uploading")
495+
return;
496+
}
493497
const config1 = {
494498
'Content-Type': 'multipart/form-data'
495499
};
496500
try {
497501
// eslint-disable-next-line no-unused-vars
498-
const res = await axios.post(`${config.backendServer}/submit`, formData, config1);
502+
const res = await axios.post(url, formData, config1);
499503
// console.log(530, 'SUCCESS!!', formData, res.status);
500504
} catch (e) {
501505
if (retries > 0) {
@@ -582,6 +586,9 @@
582586
return criteria1 && criteria2;
583587
});
584588
},
589+
shouldUpload() {
590+
return !!(config.backendServer && this.$store.getters.getAuthToken);
591+
},
585592
context() {
586593
/* eslint-disable */
587594
if (this.activity['http://schema.repronim.org/order']) {

0 commit comments

Comments
 (0)