| 31 | }) |
| 32 | |
| 33 | const err = (error) => { |
| 34 | const response = error.response |
| 35 | let countNotify = store.getters.countNotify |
| 36 | if (response) { |
| 37 | console.log(response) |
| 38 | if (response.status === 403) { |
| 39 | const data = response.data |
| 40 | countNotify++ |
| 41 | store.commit('SET_COUNT_NOTIFY', countNotify) |
| 42 | notification.error({ |
| 43 | top: '65px', |
| 44 | message: i18n.global.t('label.forbidden'), |
| 45 | description: data.message, |
| 46 | onClose: () => { |
| 47 | let countNotify = store.getters.countNotify |
| 48 | countNotify > 0 ? countNotify-- : countNotify = 0 |
| 49 | store.commit('SET_COUNT_NOTIFY', countNotify) |
| 50 | } |
| 51 | }) |
| 52 | } |
| 53 | if (response.status === 401) { |
| 54 | if (response.config && response.config.params && ['forgotPassword', 'listIdps', 'cloudianIsEnabled'].includes(response.config.params.command)) { |
| 55 | return |
| 56 | } |
| 57 | const originalPath = router.currentRoute.value.path |
| 58 | for (const key in response.data) { |
| 59 | if (key.includes('response')) { |
| 60 | if (response.data[key].errortext.includes('not available for user')) { |
| 61 | countNotify++ |
| 62 | store.commit('SET_COUNT_NOTIFY', countNotify) |
| 63 | notification.error({ |
| 64 | top: '65px', |
| 65 | message: 'Error', |
| 66 | description: response.data[key].errortext + ' ' + i18n.global.t('error.unable.to.proceed'), |
| 67 | duration: 0, |
| 68 | onClose: () => { |
| 69 | let countNotify = store.getters.countNotify |
| 70 | countNotify > 0 ? countNotify-- : countNotify = 0 |
| 71 | store.commit('SET_COUNT_NOTIFY', countNotify) |
| 72 | } |
| 73 | }) |
| 74 | return |
| 75 | } |
| 76 | } |
| 77 | } |
| 78 | countNotify++ |
| 79 | store.commit('SET_COUNT_NOTIFY', countNotify) |
| 80 | if (originalPath === '/verify2FA' || originalPath === '/setup2FA') { |
| 81 | notification.error({ |
| 82 | top: '65px', |
| 83 | message: i18n.global.t('label.2FA'), |
| 84 | description: i18n.global.t('message.error.verifying.2fa'), |
| 85 | key: 'http-401', |
| 86 | duration: 0, |
| 87 | onClose: () => { |
| 88 | let countNotify = store.getters.countNotify |
| 89 | countNotify > 0 ? countNotify-- : countNotify = 0 |
| 90 | store.commit('SET_COUNT_NOTIFY', countNotify) |