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'"
|
: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);
|
||||||
|
let resp;
|
||||||
|
try {
|
||||||
|
resp = bap.file.response;
|
||||||
if (resp.success) {
|
if (resp.success) {
|
||||||
fileField.setValue(resp.fileName);
|
fileField.setValue(resp.fileName);
|
||||||
|
console.log(fileField.value);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('not yet');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
|
Loading…
Reference in New Issue
Block a user