js code maintenance and tidy
Signed-off-by: dartcafe <github@dartcafe.de>
This commit is contained in:
Родитель
09be13f03b
Коммит
45ca1fa8e9
|
@ -226,7 +226,7 @@ export default {
|
|||
try {
|
||||
const requests = dispatches.map(dispatches => this.$store.dispatch(dispatches))
|
||||
await Promise.all(requests)
|
||||
} catch (e) {
|
||||
} catch {
|
||||
showError(t('polls', 'Error loading poll list'))
|
||||
}
|
||||
},
|
||||
|
|
|
@ -70,7 +70,7 @@ export default {
|
|||
const response = await this.$store.dispatch('poll/getParticipantsEmailAddresses', { pollId: this.poll.id })
|
||||
await this.$copyText(response.data)
|
||||
showSuccess(t('polls', 'Link copied to clipboard'))
|
||||
} catch (e) {
|
||||
} catch {
|
||||
showError(t('polls', 'Error while copying link to clipboard'))
|
||||
}
|
||||
},
|
||||
|
|
|
@ -67,7 +67,7 @@ export default {
|
|||
try {
|
||||
const response = await this.$store.dispatch('share/resendInvitation')
|
||||
showSuccess(t('polls', 'Invitation resent to {emailAddress}', { emailAddress: response.data.share.emailAddress }))
|
||||
} catch (e) {
|
||||
} catch {
|
||||
showError(t('polls', 'Mail could not be resent to {emailAddress}', { emailAddress: this.share.emailAddress }))
|
||||
}
|
||||
},
|
||||
|
@ -76,7 +76,7 @@ export default {
|
|||
try {
|
||||
await this.$copyText(this.personalLink)
|
||||
showSuccess(t('polls', 'Link copied to clipboard'))
|
||||
} catch (e) {
|
||||
} catch {
|
||||
showError(t('polls', 'Error while copying link to clipboard'))
|
||||
}
|
||||
},
|
||||
|
|
|
@ -101,7 +101,7 @@ export default {
|
|||
await axios.get(generateUrl('apps/polls/check/emailaddress') + '/' + this.emailAddress)
|
||||
this.checkResult = t('polls', 'valid email address.')
|
||||
this.checkStatus = 'success'
|
||||
} catch (e) {
|
||||
} catch {
|
||||
this.checkResult = t('polls', 'Invalid email address.')
|
||||
this.checkStatus = 'error'
|
||||
} finally {
|
||||
|
|
|
@ -226,7 +226,7 @@ export default {
|
|||
await axios.post(generateUrl('apps/polls/check/username'), { userName: this.userName, token: this.$route.params.token })
|
||||
this.checkingUserName = false
|
||||
this.isValidName = true
|
||||
} catch (e) {
|
||||
} catch {
|
||||
this.checkingUserName = false
|
||||
this.isValidName = false
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ export default {
|
|||
await axios.get(generateUrl('apps/polls/check/emailaddress') + '/' + this.emailAddress)
|
||||
this.isValidEmailAddress = true
|
||||
this.checkingEmailAddress = false
|
||||
} catch (e) {
|
||||
} catch {
|
||||
this.isValidEmailAddress = false
|
||||
this.checkingEmailAddress = false
|
||||
}
|
||||
|
@ -264,7 +264,7 @@ export default {
|
|||
this.$router.replace({ name: 'publicVote', params: { token: response.token } })
|
||||
this.closeModal()
|
||||
}
|
||||
} catch (e) {
|
||||
} catch {
|
||||
showError(t('polls', 'Error saving username', 1, this.poll.title))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ export default {
|
|||
id: payload.id,
|
||||
emailAddress: payload.emailAddress,
|
||||
})
|
||||
} catch (e) {
|
||||
} catch {
|
||||
showError(t('polls', 'Error while adding share'))
|
||||
}
|
||||
},
|
||||
|
|
|
@ -122,7 +122,7 @@ export default {
|
|||
async getEvents() {
|
||||
try {
|
||||
const response = await this.$store.dispatch('options/getEvents', { option: this.option })
|
||||
this.events = response.events
|
||||
this.events = response.data.events
|
||||
} catch (e) {
|
||||
if (e.message === 'Network Error') {
|
||||
showError(t('polls', 'Got a network error while checking calendar events.'))
|
||||
|
|
|
@ -59,8 +59,7 @@ export default {
|
|||
try {
|
||||
await this.$store.dispatch('comments/add', { message: this.comment })
|
||||
this.comment = ''
|
||||
} catch (e) {
|
||||
console.error('Error while saving comment - Error: ', e.response)
|
||||
} catch {
|
||||
showError(t('polls', 'Error while saving comment'))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
|
||||
<script>
|
||||
import moment from '@nextcloud/moment'
|
||||
import { showSuccess, showError } from '@nextcloud/dialogs'
|
||||
import { showError } from '@nextcloud/dialogs'
|
||||
import { Actions, ActionButton } from '@nextcloud/vue'
|
||||
import { mapState } from 'vuex'
|
||||
|
||||
|
@ -91,10 +91,8 @@ export default {
|
|||
this.deleteTimeout = setTimeout(async() => {
|
||||
try {
|
||||
await this.$store.dispatch({ type: 'comments/delete', comment: this.comment })
|
||||
showSuccess(t('polls', 'Comment deleted'))
|
||||
} catch (error) {
|
||||
} catch {
|
||||
showError(t('polls', 'Error while deleting the comment'))
|
||||
console.error(error.response)
|
||||
} finally {
|
||||
clearInterval(this.deleteInterval)
|
||||
this.deleteTimeout = null
|
||||
|
|
|
@ -97,7 +97,7 @@ export default {
|
|||
this.cancel()
|
||||
showSuccess(t('polls', 'Poll "{pollTitle}" added', { pollTitle: response.data.title }))
|
||||
this.$router.push({ name: 'vote', params: { id: response.data.id } })
|
||||
} catch (e) {
|
||||
} catch {
|
||||
showError(t('polls', 'Error while creating Poll "{pollTitle}"', { pollTitle: this.title }))
|
||||
}
|
||||
},
|
||||
|
|
|
@ -124,13 +124,13 @@ export default {
|
|||
},
|
||||
},
|
||||
|
||||
// created() {
|
||||
// this.timedReload()
|
||||
// },
|
||||
//
|
||||
// beforeDestroy() {
|
||||
// window.clearInterval(this.reloadTimer)
|
||||
// },
|
||||
created() {
|
||||
this.timedReload()
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
window.clearInterval(this.reloadTimer)
|
||||
},
|
||||
|
||||
methods: {
|
||||
closeCreate() {
|
||||
|
@ -152,17 +152,17 @@ export default {
|
|||
try {
|
||||
const response = await this.$store.dispatch('poll/clone', { pollId: pollId })
|
||||
emit('update-polls')
|
||||
this.$router.push({ name: 'vote', params: { id: response.id } })
|
||||
} catch (e) {
|
||||
this.$router.push({ name: 'vote', params: { id: response.data.id } })
|
||||
} catch {
|
||||
showError(t('polls', 'Error cloning poll.'))
|
||||
}
|
||||
},
|
||||
|
||||
async switchDeleted(pollId) {
|
||||
try {
|
||||
this.$store.dispatch('poll/switchDeleted', { pollId: pollId })
|
||||
await this.$store.dispatch('poll/switchDeleted', { pollId: pollId })
|
||||
emit('update-polls')
|
||||
} catch (e) {
|
||||
} catch {
|
||||
showError(t('polls', 'Error deleting poll.'))
|
||||
}
|
||||
},
|
||||
|
@ -175,7 +175,7 @@ export default {
|
|||
if (this.$route.params.id && this.$route.params.id === pollId) {
|
||||
this.$router.push({ name: 'list', params: { type: 'deleted' } })
|
||||
}
|
||||
} catch (e) {
|
||||
} catch {
|
||||
showError(t('polls', 'Error deleting poll.'))
|
||||
}
|
||||
},
|
||||
|
|
|
@ -140,8 +140,8 @@ export default {
|
|||
},
|
||||
|
||||
methods: {
|
||||
writeValue(value) {
|
||||
this.$store.commit('settings/setPreference', value)
|
||||
async writeValue(value) {
|
||||
await this.$store.commit('settings/setPreference', value)
|
||||
this.$store.dispatch('settings/write')
|
||||
},
|
||||
},
|
||||
|
|
|
@ -130,16 +130,16 @@ export default {
|
|||
},
|
||||
|
||||
methods: {
|
||||
writeValue(value) {
|
||||
this.$store.commit('settings/setPreference', value)
|
||||
async writeValue(value) {
|
||||
await this.$store.commit('settings/setPreference', value)
|
||||
this.$store.dispatch('settings/write')
|
||||
},
|
||||
|
||||
clickedCalendar(calendar) {
|
||||
async clickedCalendar(calendar) {
|
||||
if (this.settings.checkCalendars.includes(calendar.key)) {
|
||||
this.writeValue({ checkCalendars: this.settings.checkCalendars.filter(item => item !== calendar.key.toString()) })
|
||||
await this.writeValue({ checkCalendars: this.settings.checkCalendars.filter(item => item !== calendar.key.toString()) })
|
||||
} else {
|
||||
this.$store.commit('settings/addCheckCalendar', { calendar: calendar })
|
||||
await this.$store.commit('settings/addCheckCalendar', { calendar: calendar })
|
||||
}
|
||||
this.$store.dispatch('settings/write')
|
||||
},
|
||||
|
|
|
@ -96,7 +96,7 @@ export default {
|
|||
try {
|
||||
await this.$copyText(payload.url)
|
||||
showSuccess(t('polls', 'Link copied to clipboard'))
|
||||
} catch (e) {
|
||||
} catch {
|
||||
showError(t('polls', 'Error while copying link to clipboard'))
|
||||
}
|
||||
},
|
||||
|
|
|
@ -73,7 +73,7 @@ export default {
|
|||
try {
|
||||
this.$copyText(payload.url)
|
||||
showSuccess(t('polls', 'Link copied to clipboard'))
|
||||
} catch (e) {
|
||||
} catch {
|
||||
showError(t('polls', 'Error while copying link to clipboard'))
|
||||
}
|
||||
},
|
||||
|
@ -90,7 +90,7 @@ export default {
|
|||
id: payload.id,
|
||||
emailAddress: payload.emailAddress,
|
||||
})
|
||||
} catch (e) {
|
||||
} catch {
|
||||
showError(t('polls', 'Error adding share'))
|
||||
}
|
||||
},
|
||||
|
|
|
@ -327,8 +327,8 @@ export default {
|
|||
this.writeValue(e)
|
||||
}, 1500),
|
||||
|
||||
successDebounced: debounce(function(response) {
|
||||
showSuccess(t('polls', '"{pollTitle}" successfully saved', { pollTitle: response.data.title }))
|
||||
successDebounced: debounce(function(title) {
|
||||
showSuccess(t('polls', '"{pollTitle}" successfully saved', { pollTitle: title }))
|
||||
emit('update-polls')
|
||||
}, 1500),
|
||||
|
||||
|
@ -361,7 +361,7 @@ export default {
|
|||
await this.$store.dispatch('poll/delete', { pollId: this.poll.id })
|
||||
emit('update-polls')
|
||||
this.$router.push({ name: 'list', params: { type: 'relevant' } })
|
||||
} catch (e) {
|
||||
} catch {
|
||||
showError(t('polls', 'Error deleting poll.'))
|
||||
}
|
||||
},
|
||||
|
@ -371,9 +371,9 @@ export default {
|
|||
showError(t('polls', 'Title must not be empty!'))
|
||||
} else {
|
||||
try {
|
||||
const response = await this.$store.dispatch('poll/update')
|
||||
this.successDebounced(response)
|
||||
} catch (e) {
|
||||
await this.$store.dispatch('poll/update')
|
||||
this.successDebounced(this.poll.title)
|
||||
} catch {
|
||||
showError(t('polls', 'Error writing poll'))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,14 +109,8 @@ export default {
|
|||
},
|
||||
|
||||
methods: {
|
||||
getEvents() {
|
||||
this.$store
|
||||
.dispatch('options/getEvents', { option: this.option })
|
||||
},
|
||||
|
||||
setVote() {
|
||||
this.$store
|
||||
.dispatch('votes/set', {
|
||||
this.$store.dispatch('votes/set', {
|
||||
option: this.option,
|
||||
userId: this.userId,
|
||||
setTo: this.nextAnswer,
|
||||
|
|
|
@ -214,8 +214,6 @@ export default {
|
|||
.user-item__name {
|
||||
min-width: initial;
|
||||
}
|
||||
// margin-bottom: 8px;
|
||||
// padding: 8px 0;
|
||||
}
|
||||
|
||||
.vote-table__votes {
|
||||
|
@ -232,7 +230,6 @@ export default {
|
|||
align-items: stretch;
|
||||
min-width: 85px;
|
||||
max-width: 280px;
|
||||
// padding: 8px 0;
|
||||
.vote-item {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ const actions = {
|
|||
try {
|
||||
const response = await axios.get(generateUrl(endPoint + '/comments'))
|
||||
context.commit('set', response.data)
|
||||
} catch (e) {
|
||||
} catch {
|
||||
context.commit('reset')
|
||||
}
|
||||
},
|
||||
|
@ -99,11 +99,8 @@ const actions = {
|
|||
}
|
||||
|
||||
try {
|
||||
const response = await axios.post(generateUrl(endPoint + '/comment'), {
|
||||
message: payload.message,
|
||||
})
|
||||
const response = await axios.post(generateUrl(endPoint + '/comment'), { message: payload.message })
|
||||
context.commit('add', { comment: response.data.comment })
|
||||
return response.data
|
||||
} catch (e) {
|
||||
console.error('Error writing comment', { error: e.response }, { payload: payload })
|
||||
throw e
|
||||
|
@ -118,9 +115,8 @@ const actions = {
|
|||
}
|
||||
|
||||
try {
|
||||
const response = await axios.delete(generateUrl(endPoint + '/comment/' + payload.comment.id))
|
||||
await axios.delete(generateUrl(endPoint + '/comment/' + payload.comment.id))
|
||||
context.commit('delete', { comment: payload.comment })
|
||||
return response.data
|
||||
} catch (e) {
|
||||
console.error('Error deleting comment', { error: e.response }, { payload: payload })
|
||||
throw e
|
||||
|
|
|
@ -233,8 +233,7 @@ const actions = {
|
|||
async getEvents(context, payload) {
|
||||
const endPoint = 'apps/polls/option'
|
||||
try {
|
||||
const response = await axios.get(generateUrl(endPoint + '/' + payload.option.id + '/events'))
|
||||
return response.data
|
||||
return await axios.get(generateUrl(endPoint + '/' + payload.option.id + '/events'))
|
||||
} catch (e) {
|
||||
return { events: [] }
|
||||
}
|
||||
|
|
|
@ -148,7 +148,6 @@ const actions = {
|
|||
const response = await axios.get(generateUrl(endPoint + '/poll'))
|
||||
context.commit('set', response.data)
|
||||
context.commit('acl/set', response.data)
|
||||
return response
|
||||
} catch (e) {
|
||||
console.debug('Error loading poll', { error: e.response })
|
||||
throw e
|
||||
|
@ -158,8 +157,7 @@ const actions = {
|
|||
async add(context, payload) {
|
||||
const endPoint = 'apps/polls/poll/add'
|
||||
try {
|
||||
const response = await axios.post(generateUrl(endPoint), { title: payload.title, type: payload.type })
|
||||
return response
|
||||
return await axios.post(generateUrl(endPoint), { title: payload.title, type: payload.type })
|
||||
} catch (e) {
|
||||
console.error('Error adding poll:', { error: e.response }, { state: state })
|
||||
throw e
|
||||
|
@ -169,8 +167,7 @@ const actions = {
|
|||
async clone(context, payload) {
|
||||
const endPoint = 'apps/polls/poll'
|
||||
try {
|
||||
const response = await axios.get(generateUrl(endPoint + '/' + payload.pollId + '/clone'))
|
||||
return response.data
|
||||
return await axios.get(generateUrl(endPoint + '/' + payload.pollId + '/clone'))
|
||||
} catch (e) {
|
||||
console.error('Error cloning poll', { error: e.response }, { payload: payload })
|
||||
}
|
||||
|
@ -181,7 +178,6 @@ const actions = {
|
|||
try {
|
||||
const response = await axios.put(generateUrl(endPoint + '/' + state.id), { poll: state })
|
||||
context.commit('set', { poll: response.data })
|
||||
return response
|
||||
} catch (e) {
|
||||
console.error('Error updating poll:', { error: e.response }, { poll: state })
|
||||
throw e
|
||||
|
@ -191,8 +187,7 @@ const actions = {
|
|||
async switchDeleted(context, payload) {
|
||||
const endPoint = 'apps/polls/poll'
|
||||
try {
|
||||
const response = await axios.put(generateUrl(endPoint + '/' + payload.pollId + '/switchDeleted'))
|
||||
return response
|
||||
await axios.put(generateUrl(endPoint + '/' + payload.pollId + '/switchDeleted'))
|
||||
} catch (e) {
|
||||
console.error('Error switching deleted status', { error: e.response }, { payload: payload })
|
||||
}
|
||||
|
@ -201,8 +196,7 @@ const actions = {
|
|||
async delete(context, payload) {
|
||||
const endPoint = 'apps/polls/poll'
|
||||
try {
|
||||
const response = await axios.delete(generateUrl(endPoint + '/' + payload.pollId))
|
||||
return response
|
||||
await axios.delete(generateUrl(endPoint + '/' + payload.pollId))
|
||||
} catch (e) {
|
||||
console.error('Error deleting poll', { error: e.response }, { payload: payload })
|
||||
}
|
||||
|
@ -211,8 +205,7 @@ const actions = {
|
|||
async getParticipantsEmailAddresses(context, payload) {
|
||||
const endPoint = 'apps/polls/poll'
|
||||
try {
|
||||
const response = await axios.get(generateUrl(endPoint + '/' + payload.pollId + '/addresses'))
|
||||
return response
|
||||
return await axios.get(generateUrl(endPoint + '/' + payload.pollId + '/addresses'))
|
||||
} catch (e) {
|
||||
console.error('Error retrieving email addresses', { error: e.response }, { payload: payload })
|
||||
}
|
||||
|
|
|
@ -56,10 +56,10 @@ const actions = {
|
|||
}
|
||||
},
|
||||
|
||||
async takeOver(context, payload) {
|
||||
takeOver(context, payload) {
|
||||
const endPoint = 'apps/polls/administration'
|
||||
if (getCurrentUser().isAdmin) {
|
||||
return await axios.get(generateUrl(endPoint + '/poll/' + payload.pollId + '/takeover'))
|
||||
axios.get(generateUrl(endPoint + '/poll/' + payload.pollId + '/takeover'))
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
@ -71,9 +71,8 @@ const actions = {
|
|||
const endPoint = 'apps/polls/preferences/get'
|
||||
try {
|
||||
const response = await axios.get(generateUrl(endPoint))
|
||||
console.debug('settings loaded ')
|
||||
context.commit('setPreference', response.data.preferences)
|
||||
} catch (e) {
|
||||
} catch {
|
||||
context.commit('reset')
|
||||
}
|
||||
},
|
||||
|
|
|
@ -105,7 +105,6 @@ const actions = {
|
|||
emailAddress: payload.emailAddress,
|
||||
})
|
||||
context.commit('set', { share: response.data.share })
|
||||
return response.data
|
||||
} catch (e) {
|
||||
console.error('Error writing email address', { error: e.response }, { payload: payload })
|
||||
throw e
|
||||
|
|
|
@ -94,14 +94,11 @@ const actions = {
|
|||
endPoint = endPoint + '/poll/' + context.rootState.route.params.id
|
||||
} else if (context.rootState.route.name === 'list' && context.rootState.route.params.id) {
|
||||
endPoint = endPoint + '/poll/' + context.rootState.route.params.id
|
||||
} else {
|
||||
context.commit('reset')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await axios.get(generateUrl(endPoint + '/shares'))
|
||||
context.commit('set', response.data)
|
||||
return response.data
|
||||
} catch (e) {
|
||||
console.error('Error loading shares', { error: e.response }, { pollId: context.rootState.route.params.id })
|
||||
throw e
|
||||
|
@ -110,6 +107,7 @@ const actions = {
|
|||
|
||||
async add(context, payload) {
|
||||
const endPoint = 'apps/polls/poll/' + context.rootState.route.params.id
|
||||
|
||||
try {
|
||||
await axios.post(generateUrl(endPoint + '/share'), payload.share)
|
||||
} catch (e) {
|
||||
|
@ -125,7 +123,7 @@ const actions = {
|
|||
context.commit('delete', { share: payload.share })
|
||||
|
||||
try {
|
||||
return await axios.delete(generateUrl(endPoint + '/' + payload.share.token))
|
||||
await axios.delete(generateUrl(endPoint + '/' + payload.share.token))
|
||||
} catch (e) {
|
||||
console.error('Error removing share', { error: e.response }, { payload: payload })
|
||||
throw e
|
||||
|
@ -149,7 +147,7 @@ const actions = {
|
|||
async resolveGroup(context, payload) {
|
||||
const endPoint = 'apps/polls/share'
|
||||
try {
|
||||
return await axios.get(generateUrl(endPoint + '/' + payload.share.token + '/resolve'))
|
||||
await axios.get(generateUrl(endPoint + '/' + payload.share.token + '/resolve'))
|
||||
} catch (e) {
|
||||
console.error('Error exploding group', e.response.data, { error: e.response }, { payload: payload })
|
||||
throw e
|
||||
|
|
|
@ -57,7 +57,7 @@ const actions = {
|
|||
try {
|
||||
const response = await axios.get(generateUrl(endPoint + '/subscription'))
|
||||
context.commit('set', response.data)
|
||||
} catch (e) {
|
||||
} catch {
|
||||
context.commit('set', false)
|
||||
}
|
||||
},
|
||||
|
|
|
@ -131,7 +131,7 @@ const actions = {
|
|||
try {
|
||||
const response = await axios.get(generateUrl(endPoint + '/votes'))
|
||||
context.commit('set', response.data)
|
||||
} catch (e) {
|
||||
} catch {
|
||||
context.commit('reset')
|
||||
}
|
||||
},
|
||||
|
@ -149,7 +149,6 @@ const actions = {
|
|||
setTo: payload.setTo,
|
||||
})
|
||||
context.commit('setItem', { option: payload.option, pollId: context.rootState.poll.id, vote: response.data.vote })
|
||||
return response.data
|
||||
} catch (e) {
|
||||
if (e.response.status === 409) {
|
||||
context.dispatch('list')
|
||||
|
|
|
@ -191,7 +191,7 @@ export default {
|
|||
try {
|
||||
await this.$store.dispatch('poll/switchDeleted', { pollId: pollId })
|
||||
emit('update-polls')
|
||||
} catch (e) {
|
||||
} catch {
|
||||
showError(t('polls', 'Error switching deleted status.'))
|
||||
}
|
||||
},
|
||||
|
@ -201,7 +201,7 @@ export default {
|
|||
await this.$store.dispatch('poll/delete', { pollId: this.deletePollId })
|
||||
emit('update-polls')
|
||||
this.deleteModal = false
|
||||
} catch (e) {
|
||||
} catch {
|
||||
showError(t('polls', 'Error deleting poll.'))
|
||||
this.deleteModal = false
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ export default {
|
|||
await this.$store.dispatch('pollsAdmin/takeOver', { pollId: this.takeOverPollId })
|
||||
emit('update-polls')
|
||||
this.takeOverModal = false
|
||||
} catch (e) {
|
||||
} catch {
|
||||
showError(t('polls', 'Error overtaking poll.'))
|
||||
this.takeOverModal = false
|
||||
}
|
||||
|
|
|
@ -199,8 +199,7 @@ export default {
|
|||
try {
|
||||
await this.$store.dispatch({ type: 'poll/get', pollId: pollId })
|
||||
emit('toggle-sidebar', { open: true })
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
} catch {
|
||||
showError(t('polls', 'Error loading poll'))
|
||||
}
|
||||
},
|
||||
|
@ -236,8 +235,9 @@ export default {
|
|||
async switchDeleted(pollId) {
|
||||
try {
|
||||
await this.$store.dispatch('poll/switchDeleted', { pollId: pollId })
|
||||
} catch {
|
||||
showError(t('polls', 'Error deleting poll.'))
|
||||
} catch (e) {
|
||||
} finally {
|
||||
emit('update-polls')
|
||||
}
|
||||
},
|
||||
|
@ -245,7 +245,7 @@ export default {
|
|||
async deletePermanently(pollId) {
|
||||
try {
|
||||
await this.$store.dispatch('poll/delete', { pollId: pollId })
|
||||
} catch (e) {
|
||||
} catch {
|
||||
showError(t('polls', 'Error deleting poll.'))
|
||||
} finally {
|
||||
emit('update-polls')
|
||||
|
@ -255,7 +255,7 @@ export default {
|
|||
async clonePoll(pollId) {
|
||||
try {
|
||||
await this.$store.dispatch('poll/clone', { pollId: pollId })
|
||||
} catch (e) {
|
||||
} catch {
|
||||
showError(t('polls', 'Error cloning poll.'))
|
||||
} finally {
|
||||
emit('update-polls')
|
||||
|
|
|
@ -349,7 +349,7 @@ export default {
|
|||
try {
|
||||
await this.$store.dispatch('share/updateEmailAddress', { emailAddress: emailAddress })
|
||||
showSuccess(t('polls', 'Email address {emailAddress} saved.', { emailAddress: emailAddress }))
|
||||
} catch (e) {
|
||||
} catch {
|
||||
showError(t('polls', 'Error saving email address {emailAddress}', { emailAddress: emailAddress }))
|
||||
}
|
||||
},
|
||||
|
@ -382,10 +382,8 @@ export default {
|
|||
this.lastUpdated = (item.updated > this.lastUpdated) ? item.updated : this.lastUpdated
|
||||
if (item.table === 'polls') {
|
||||
dispatches.push('poll/get')
|
||||
// this.$store.dispatch('poll/get')
|
||||
} else {
|
||||
dispatches.push(item.table + '/list')
|
||||
// this.$store.dispatch('poll/' + item.table + '/list')
|
||||
}
|
||||
})
|
||||
const requests = dispatches.map(dispatches => this.$store.dispatch(dispatches))
|
||||
|
|
Загрузка…
Ссылка в новой задаче