2022-12-03 03:20:49 +00:00
|
|
|
import { createApp } from "vue";
|
|
|
|
import { createPinia } from "pinia";
|
|
|
|
|
|
|
|
import { createVuetify } from "vuetify";
|
|
|
|
import { aliases, mdi } from "vuetify/iconsets/mdi-svg";
|
|
|
|
|
2022-12-04 05:19:41 +00:00
|
|
|
import axios from "axios";
|
|
|
|
|
2022-12-03 03:20:49 +00:00
|
|
|
import App from "./App.vue";
|
|
|
|
import router from "./router";
|
2022-12-06 13:20:36 +00:00
|
|
|
import { useMastodonStore } from "./stores/mastodon";
|
2022-12-03 03:20:49 +00:00
|
|
|
|
|
|
|
import "./assets/style.css";
|
|
|
|
import "vuetify/styles";
|
|
|
|
|
|
|
|
const vuetify = createVuetify({
|
|
|
|
theme: {
|
|
|
|
defaultTheme: "dark",
|
|
|
|
},
|
|
|
|
icons: {
|
|
|
|
aliases,
|
|
|
|
sets: {
|
|
|
|
mdi,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2022-12-06 08:57:20 +00:00
|
|
|
axios.defaults.withCredentials = true;
|
2022-12-06 13:20:36 +00:00
|
|
|
// if audon server returns 401, display the login form
|
2022-12-06 08:57:20 +00:00
|
|
|
axios.interceptors.response.use(undefined, (error) => {
|
|
|
|
if (error.response?.status === 401) {
|
2022-12-06 13:20:36 +00:00
|
|
|
const donStore = useMastodonStore();
|
|
|
|
donStore.$reset();
|
2022-12-06 08:57:20 +00:00
|
|
|
}
|
|
|
|
return Promise.reject(error);
|
|
|
|
});
|
2022-12-04 05:19:41 +00:00
|
|
|
|
2022-12-06 13:20:36 +00:00
|
|
|
router.afterEach((to) => {
|
|
|
|
const donStore = useMastodonStore();
|
|
|
|
if (!to.meta.noauth && !donStore.authorized) {
|
|
|
|
router.push({ name: "login" });
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2022-12-03 03:20:49 +00:00
|
|
|
const app = createApp(App);
|
|
|
|
|
|
|
|
app.use(createPinia());
|
|
|
|
app.use(vuetify);
|
|
|
|
app.use(router);
|
|
|
|
|
2022-12-06 06:09:15 +00:00
|
|
|
// app.config.compilerOptions.delimiters = ["{%", "%}"];
|
2022-12-03 03:20:49 +00:00
|
|
|
app.mount("#app");
|