mirror of
https://github.com/h3poteto/whalebird-desktop
synced 2025-02-08 07:48:45 +01:00
refs #2258 Add delete filter form
This commit is contained in:
parent
783ddddafe
commit
9b16716a80
@ -139,7 +139,10 @@
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"title": "Delete"
|
||||
"title": "Delete",
|
||||
"confirm": "Are you sure to delete this filter?",
|
||||
"confirm_ok": "Delete",
|
||||
"confirm_cancel": "Cancel"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -60,7 +60,13 @@ export default {
|
||||
return this.$route.params.id
|
||||
},
|
||||
deleteFilter(id) {
|
||||
console.log(id)
|
||||
this.$confirm(this.$t('settings.filters.delete.confirm'), 'Warning', {
|
||||
confirmButtonText: this.$t('settings.filters.delete.confirm_ok'),
|
||||
cancelButtonText: this.$t('settings.filters.delete.confirm_cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
return this.$store.dispatch('Settings/Filters/deleteFilter', id)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -42,6 +42,21 @@ export const actions: ActionTree<FiltersState, RootState> = {
|
||||
} finally {
|
||||
commit(MUTATION_TYPES.CHANGE_LOADING, false)
|
||||
}
|
||||
},
|
||||
deleteFilter: async ({ commit, dispatch, rootState }, id: string) => {
|
||||
const client = generator(
|
||||
rootState.TimelineSpace.sns,
|
||||
rootState.TimelineSpace.account.baseURL,
|
||||
rootState.TimelineSpace.account.accessToken,
|
||||
rootState.App.userAgent
|
||||
)
|
||||
try {
|
||||
commit(MUTATION_TYPES.CHANGE_LOADING, true)
|
||||
await client.deleteFilter(id)
|
||||
await dispatch('fetchFilters')
|
||||
} finally {
|
||||
commit(MUTATION_TYPES.CHANGE_LOADING, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user