Better throttle, attempt to have proper UX

This commit is contained in:
Spitap
2023-02-07 12:47:58 +01:00
parent 5cf2976013
commit 8c0fb3d4ff
14 changed files with 77 additions and 94 deletions
+5 -3
View File
@@ -60,9 +60,11 @@ export default {
}),
methods: {
showNotification (options) {
this.notification = options.msg
this.notificationColor = (options.type) ? options.type : 'success'
this.snackbar = true
if (this.isAuthenticated) {
this.notification = options.msg
this.notificationColor = (options.type) ? options.type : 'success'
this.snackbar = true
}
}
}
}
+5
View File
@@ -3,6 +3,7 @@ import Cookies from 'js-cookie'
import router from '../router'
import store from '../store'
import app from '../App.vue'
const _axios = axios.create()
@@ -31,6 +32,10 @@ _axios.interceptors.response.use(
router.push({ name: 'TwoFA' })
return Promise.reject(error)
}
if (error.response.status === 429) {
app.showNotification()
return Promise.reject(error)
}
if (error.response.status !== 401 || router.currentRoute.path === '/login/') {
return Promise.reject(error)
}