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

@ -13,7 +13,6 @@ export const login = ({ commit }, data) => {
commit('user/' + userTypes.RESET_CURRENT_USER, null, { root: true })
commit(rootTypes.UPDATE_APP_LOADING_STATUS, false, { root: true })
window.toastr['success']('Login Successful')
resolve(response)
})
.catch((err) => {
@ -28,7 +27,7 @@ export const setLogoutFalse = ({ state, commit }) => {
commit(types.SET_LOGOUT, false)
}
export const logout = ({ state, commit }) => {
export const logout = ({ state, commit, dispatch }) => {
return new Promise((resolve, reject) => {
if (state.isLoggedOut) {
resolve()
@ -40,7 +39,14 @@ export const logout = ({ state, commit }) => {
.get('/auth/logout')
.then(() => {
router.push('/login')
window.toastr['success']('Logged out!', 'Success')
dispatch(
'notification/showNotification',
{
type: 'success',
message: 'Logged out successfully.',
},
{ root: true }
)
})
.catch((err) => {
router.push('/login')