Skip to content

Commit

Permalink
Fix shortcut id and added props #1130
Browse files Browse the repository at this point in the history
  • Loading branch information
friday committed Sep 25, 2022
1 parent c9145fa commit 46ad331
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions preferences-src/src/components/pages/EditShortcut.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const shortcutIconEventName = 'shortcut-icon-event'
export default {
name: 'edit-shortcut',
props: ['id', 'icon', 'name', 'keyword', 'cmd', 'is_default_search', 'run_without_argument'],
props: ['added', 'id', 'icon', 'name', 'keyword', 'cmd', 'is_default_search', 'run_without_argument'],
created() {
bus.$on(shortcutIconEventName, this.onIconSelected)
},
Expand Down Expand Up @@ -123,16 +123,18 @@ export default {
}
let shortcut = {
id: this.id || '',
icon: this.localIcon || '',
name: this.localName,
keyword: this.localKeyword.trim(),
cmd: this.localCmd,
is_default_search: this.localIsDefaultSearch,
run_without_argument: this.localRunWithoutArgument
}
let method = shortcut.id ? 'update' : 'add'
fetchData('prefs:///shortcut/' + method, shortcut).then(this.hide, err => bus.$emit('error', err))
if (this.id) { // Editing existing shortcut
shortcut.id = this.id;
shortcut.added = this.added;
}
fetchData('prefs:///shortcut/update', shortcut).then(this.hide, err => bus.$emit('error', err))
},
hide() {
this.$router.push({ path: '/shortcuts' })
Expand Down

0 comments on commit 46ad331

Please sign in to comment.