fix(components): catch possible exceptions in uploadOrPaste component instead of letting them fail the whole opreation

This commit is contained in:
parent e9c4de973a
commit afcd71a50d
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

@ -29,17 +29,26 @@
:name="fname + 'content'" :name="fname + 'content'"
/> />
<a-upload <a-upload
:with-credentials="true"
v-model:file-list="fileList" v-model:file-list="fileList"
v-else-if="pvalue === 'upload'" v-else-if="pvalue === 'upload'"
:name="fname + 'file'" :name="fname + 'file'"
accept=".doc,.docx,.md,.markdown" accept=".doc,.docx,.md,.markdown"
:max-count="1" :max-count="1"
action="/api/upload/content"
method="post"
@reject="(a) => console.error(a)"
@change=" @change="
({ file }) => { (bap) => {
let resp = JSON.parse(file.response); console.log(bap);
if (resp.success) { let resp;
fileField.setValue(resp.fileName); try {
resp = bap.file.response;
if (resp.success) {
fileField.setValue(resp.fileName);
console.log(fileField.value);
}
} catch (e) {
console.error('not yet');
} }
} }
" "