Add New SweetAlert & Notification Components

This commit is contained in:
Aman Upadhyay
2021-04-09 12:35:50 +00:00
committed by Mohit Panjwani
parent 3f7db2793f
commit c3d3e5e35f
78 changed files with 2295 additions and 984 deletions

View File

@ -92,6 +92,7 @@ const {
sameAs,
minLength,
} = require('vuelidate/lib/validators')
import { mapActions } from 'vuex'
export default {
data() {
@ -120,6 +121,7 @@ export default {
},
},
methods: {
...mapActions('notification', ['showNotification']),
async validateBeforeSubmit(e) {
this.$v.formData.$touch()
@ -135,18 +137,18 @@ export default {
let res = await axios.post('/api/v1/auth/reset/password', data)
this.isLoading = false
if (res.data) {
toastr['success'](
this.$t('login.password_reset_successfully'),
'Success'
)
this.showNotification({
type: 'success',
message: this.$t('login.password_reset_successfully'),
})
this.$router.push('/login')
}
} catch (err) {
if (err.response && err.response.status === 403) {
toastr['error'](
err.response.data,
this.$t('validation.email_incorrect')
)
this.showNotification({
type: 'error',
message: this.$t('validation.email_incorrect'),
})
this.isLoading = false
}
}