Skip to content

Commit

Permalink
fix: review
Browse files Browse the repository at this point in the history
  • Loading branch information
yaoyun8 committed Oct 8, 2024
1 parent d775836 commit 3cad14b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
14 changes: 5 additions & 9 deletions packages/toolbars/preview/src/Main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,20 @@ export default {
const { beforePreview, previewMethod, afterPreview } = getOptions(meta.id)
const printer = console
if (typeof beforePreview === 'function') {
try {
try {
if (typeof beforePreview === 'function') {
await beforePreview()
} catch (error) {
printer.log('Error in beforePreview:', error)
}
}
if (typeof previewMethod === 'function') {
try {
if (typeof previewMethod === 'function') {
const stop = await previewMethod()
if (stop) {
return
}
} catch (error) {
printer.log('Error in previewMethod:', error)
}
} catch (error) {
printer.log(error)
}
if (useLayout().isEmptyPage()) {
Expand Down
16 changes: 6 additions & 10 deletions packages/toolbars/save/src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,24 +100,20 @@ export const openCommon = async () => {
const { beforeSave, saveMethod, saved } = getOptions(meta.id)
const printer = console

if (typeof beforeSave === 'function') {
try {
try {
if (typeof beforeSave === 'function') {
await beforeSave()
} catch (error) {
printer.log('Error in beforeSave:', error)
}
}

if (typeof saveMethod === 'function') {
try {
if (typeof saveMethod === 'function') {
const stop = await saveMethod()

if (stop) {
return
}
} catch (error) {
printer.log('Error in saveMethod:', error)
}
} catch (error) {
printer.log(error)
}

const pageStatus = useLayout().layoutState?.pageStatus
Expand Down Expand Up @@ -168,7 +164,7 @@ export const openCommon = async () => {
try {
saved()
} catch (error) {
printer.log('Error in saved:', error)
printer.log(error)
}
}
})
Expand Down

0 comments on commit 3cad14b

Please sign in to comment.