Files
habitica/website/client/src/components/challenges/leaveChallengeModal.vue
T
Natalie L 5d87c2af13 fix: I18n string update (#13588)
* i18n string updates (issue #9210)

* change offHand to offHandCapitalized

* added removeTasks to challenge.json

* added hairBangs back to character.json

* added hairBangs back to character.json

* more hairBangs nonsense

* added hairBangs to hair-settings.vue, removed same from character.json

* changed levelUp to levelup in levelUp.vue and achievements.json

* fix duplicate string values

* fixed different strings with same content in different files

* updated test/api/v3 and test/api/v4 with messageTaskNotFound

* Delete POST-tasks_taskId_checklist_itemId_score.test.js

File got copied to a new directory, doesn't need to be here.

* fix: userID token in patrons.vue and heroes.vue

* removed: unused clock of code

* Restored eggsItemType to inventory.json

Co-authored-by: Sabe Jones <sabrecat@gmail.com>
2021-11-04 16:33:08 -05:00

63 lines
1.4 KiB
Vue

<template>
<b-modal
id="leave-challenge-modal"
:title="$t('leaveChallenge')"
size="sm"
:hide-footer="true"
>
<div class="modal-body">
<h2>{{ $t('confirmKeepChallengeTasks') }}</h2>
<div>
<button
class="btn btn-primary"
@click="leaveChallenge('keep')"
>
{{ $t('keepTasks') }}
</button>
<button
class="btn btn-danger"
@click="leaveChallenge('remove-all')"
>
{{ $t('removeTasks') }}
</button>
</div>
</div>
</b-modal>
</template>
<style scoped>
.modal-body {
padding-bottom: 2em;
}
</style>
<script>
import findIndex from 'lodash/findIndex';
import { mapState } from '@/libs/store';
import notifications from '@/mixins/notifications';
export default {
mixins: [notifications],
props: ['challengeId'],
computed: {
...mapState({ user: 'user.data' }),
},
methods: {
async leaveChallenge (keep) {
const index = findIndex(this.user.challenges, id => id === this.challengeId);
this.user.challenges.splice(index, 1);
await this.$store.dispatch('challenges:leaveChallenge', {
challengeId: this.challengeId,
keep,
});
await this.$store.dispatch('tasks:fetchUserTasks', { forceLoad: true });
this.close();
},
close () {
this.$emit('update-challenge');
this.$root.$emit('bv::hide::modal', 'leave-challenge-modal');
},
},
};
</script>