add toasts

This commit is contained in:
Kamila 2024-07-25 17:47:32 +02:00
parent 2bfc781bc3
commit f027e66dc6
3 changed files with 31 additions and 21 deletions

View File

@ -11,8 +11,8 @@
<!-- Using components -->
<BInputGroup :prepend="$t('unregister_mail.info')" class="mt-3">
<BFormInput readonly v-model="props.email" />
<BInputGroupText >
<BButton variant="outline-success" class="test-button " @click="sendRegisterMail">
<BInputGroupText>
<BButton variant="outline-success" class="test-button" @click="sendRegisterMail">
{{ $t('unregister_mail.button') }}
</BButton>
</BInputGroupText>
@ -26,6 +26,7 @@ import { sendActivationEmail } from '../graphql/sendActivationEmail'
import { BButton, BFormInput, BInputGroup, BInputGroupText } from 'bootstrap-vue-next'
import { useI18n } from 'vue-i18n'
import { useMutation } from '@vue/apollo-composable'
import { useAppToast } from '@/composables/useToast'
const props = defineProps({
checked: {
@ -40,6 +41,7 @@ const props = defineProps({
})
const { t } = useI18n()
const { toastError, toastSuccess } = useAppToast()
const { mutate: activateEmail } = useMutation(sendActivationEmail)
@ -48,9 +50,9 @@ const sendRegisterMail = async () => {
await activateEmail({
email: props.email,
})
// toast.success(t('unregister_mail.success', { email: props.email }))
toastSuccess(t('unregister_mail.success', { email: props.email }))
} catch (error) {
// toast.error(t('unregister_mail.error', { message: error.message }))
toastError(t('unregister_mail.error', { message: error.message }))
}
}
</script>

View File

@ -20,7 +20,11 @@
<BInputGroup prepend="GDD" append=".00">
<BFormInput v-model="value" type="number" :min="rangeMin" :max="rangeMax" />
</BInputGroup>
<BInputGroup prepend="0" :append="String(rangeMax)" class="mt-3 flex-nowrap align-items-center">
<BInputGroup
prepend="0"
:append="String(rangeMax)"
class="mt-3 flex-nowrap align-items-center"
>
<BFormInput v-model="value" type="range" :min="rangeMin" :max="rangeMax" step="10" />
</BInputGroup>
</div>
@ -38,10 +42,10 @@
</div>
</div>
<div class="buttons-wrapper d-flex justify-content-between">
<BButton type="reset" variant="danger" @click="onReset()">
{{ $t('creation_form.reset') }}
</BButton>
<div >
<BButton type="reset" variant="danger" @click="onReset()">
{{ $t('creation_form.reset') }}
</BButton>
<div>
<BButton
v-if="pagetype === 'PageCreationConfirm'"
type="button"
@ -72,6 +76,7 @@
<script setup>
import { ref, watch, computed } from 'vue'
import { useI18n } from 'vue-i18n'
import { useAppToast } from '@/composables/useToast'
import { useMutation, useQuery } from '@vue/apollo-composable'
import { useStore } from 'vuex'
import { adminCreateContribution } from '../graphql/adminCreateContribution'
@ -86,6 +91,7 @@ import {
} from 'bootstrap-vue-next'
const { radioOptions } = useCreationMonths()
const { toastError, toastSuccess } = useAppToast()
const props = defineProps({
pagetype: {
@ -153,16 +159,16 @@ const submitCreation = async () => {
store.commit('openCreationsPlus', 1)
// toast.success(
// t('creation_form.toasted', {
// value: value.value,
// email: props.item.email,
// }),
// )
toastSuccess(
t('creation_form.toasted', {
value: value.value,
email: props.item.email,
}),
)
onReset()
} catch (error) {
// toast.error(error.message)
toastError(error.message)
onReset()
} finally {
refetch()
@ -180,7 +186,7 @@ watch(
)
</script>
<style scoped>
.buttons-wrapper{
.buttons-wrapper {
margin: 1.5rem 2.4rem;
}
</style>
</style>

View File

@ -22,12 +22,14 @@ import { useI18n } from 'vue-i18n'
import { BTable, BPagination } from 'bootstrap-vue-next'
import { listTransactionLinksAdmin } from '../graphql/listTransactionLinksAdmin.js'
import { useQuery } from '@vue/apollo-composable'
import { useAppToast } from '@/composables/useToast'
const props = defineProps({
userId: { type: Number, required: true },
})
const { t, d } = useI18n()
const { toastError } = useAppToast()
const items = ref([])
const rows = ref(0)
@ -68,7 +70,7 @@ const { result, error, refetch } = useQuery(listTransactionLinksAdmin, () => ({
currentPage: currentPage.value,
pageSize: perPage.value,
userId: props.userId,
}));
}))
watch(result, (newResult) => {
if (newResult && newResult.listTransactionLinksAdmin) {
@ -79,11 +81,11 @@ watch(result, (newResult) => {
watch(error, (err) => {
if (err) {
// toast.error(error.message)
toastError(error.message)
}
})
watch([currentPage, perPage], () => {
refetch()
})
</script>
</script>