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