feat: FRO-2 Implement Login Component (#8)
Reviewed-on: #8 Reviewed-by: lq64 <lq@blackhole.local> Co-authored-by: Janis <janis.e.20@gmx.de> Co-committed-by: Janis <janis.e.20@gmx.de>
This commit is contained in:
15
src/main.ts
15
src/main.ts
@@ -11,17 +11,18 @@ import 'quasar/dist/quasar.css'
|
||||
import { createPinia } from 'pinia'
|
||||
import axios from 'axios'
|
||||
import VueAxios from 'vue-axios'
|
||||
import {useUserInfo} from "@/composables/useUserInfo.ts";
|
||||
|
||||
const app = createApp(App)
|
||||
const pinia = createPinia()
|
||||
|
||||
app.use(pinia)
|
||||
app.use(router)
|
||||
app.use(Quasar, {
|
||||
plugins: {
|
||||
Notify
|
||||
},
|
||||
})
|
||||
app.use(pinia)
|
||||
app.use(VueAxios, axios)
|
||||
app.use(Particles, {
|
||||
init: async engine => {
|
||||
@@ -29,4 +30,16 @@ app.use(Particles, {
|
||||
},
|
||||
})
|
||||
|
||||
axios.interceptors.response.use(
|
||||
res => res,
|
||||
err => {
|
||||
if (err.response?.status === 401) {
|
||||
const info = useUserInfo();
|
||||
info.clearUserInfo();
|
||||
router.replace({name: 'login'});
|
||||
}
|
||||
return Promise.reject(err);
|
||||
}
|
||||
);
|
||||
|
||||
app.mount('#app')
|
||||
|
||||
Reference in New Issue
Block a user