diff options
author | dartcafe <github@dartcafe.de> | 2022-08-06 11:03:57 +0300 |
---|---|---|
committer | dartcafe <github@dartcafe.de> | 2022-08-21 02:29:30 +0300 |
commit | ceff9809a8ccdf0a0c4cb5f231bbc66a6afd24e8 (patch) | |
tree | 176b2a9a5709e43c2263525dd85109b86f155542 /src | |
parent | 96eead52d6a45654e74fd018c957021eadb36536 (diff) |
send out confirmed options
Signed-off-by: dartcafe <github@dartcafe.de>
Diffstat (limited to 'src')
-rw-r--r-- | src/js/components/Configuration/ConfigClosing.vue | 17 | ||||
-rw-r--r-- | src/js/store/modules/poll.js | 11 |
2 files changed, 28 insertions, 0 deletions
diff --git a/src/js/components/Configuration/ConfigClosing.vue b/src/js/components/Configuration/ConfigClosing.vue index 925fbbeb..b7529c07 100644 --- a/src/js/components/Configuration/ConfigClosing.vue +++ b/src/js/components/Configuration/ConfigClosing.vue @@ -29,6 +29,12 @@ </template> {{ closed ? t('polls', 'Reopen poll'): t('polls', 'Close poll') }} </VueButton> + <VueButton @click="sendConfirmation()"> + <template #icon> + <OpenPollIcon v-if="closed" /> + </template> + {{ t('polls', 'Send Confirmation') }} + </VueButton> <CheckboxRadioSwitch v-show="!closed" :checked.sync="useExpire" type="switch"> {{ t('polls', 'Poll closing date') }} </CheckboxRadioSwitch> @@ -38,6 +44,7 @@ <script> import { mapState, mapGetters } from 'vuex' +import { showError, showSuccess } from '@nextcloud/dialogs' import moment from '@nextcloud/moment' import { Button as VueButton, DatetimePicker, CheckboxRadioSwitch } from '@nextcloud/vue' import OpenPollIcon from 'vue-material-design-icons/LockOpenVariant.vue' @@ -120,6 +127,16 @@ export default { this.$emit('change') }, + + async sendConfirmation() { + const confirmations = await this.$store.dispatch('poll/sendConfirmation') + confirmations.sent.forEach((confirmation) => { + showSuccess(t('polls', `Confirmation sent to ${confirmation}`)) + }) + confirmations.error.forEach((confirmation) => { + showError(t('polls', `Confirmation could not be sent to ${confirmation}`)) + }) + }, }, } </script> diff --git a/src/js/store/modules/poll.js b/src/js/store/modules/poll.js index e01a6769..d85827af 100644 --- a/src/js/store/modules/poll.js +++ b/src/js/store/modules/poll.js @@ -247,6 +247,17 @@ const actions = { } }, + async sendConfirmation(context, payload) { + const endPoint = `apps/polls/poll/${context.rootState.route.params.id}/confirmation` + try { + const response = await axios.post(generateUrl(endPoint)) + console.log(response.data) + return response.data.confirmations + } catch (e) { + console.error('Error sending confirmation', { error: e.response }, { payload }) + } + }, + async delete(context, payload) { const endPoint = `apps/polls/poll/${payload.pollId}` try { |