parent
7dba1a1846
commit
ef415d080a
|
@ -1,6 +1,7 @@
|
|||
import { boot } from 'quasar/wrappers';
|
||||
import qFormMixin from './qformMixin';
|
||||
import keyShortcut from './keyShortcut';
|
||||
import { setupAxios } from 'src/boot/axios';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import { CanceledError } from 'axios';
|
||||
|
||||
|
@ -48,4 +49,5 @@ export default boot(({ app }) => {
|
|||
|
||||
notify(message ?? 'globals.error', 'negative', 'error');
|
||||
};
|
||||
setupAxios();
|
||||
});
|
||||
|
|
|
@ -8,9 +8,13 @@ import useNotify from './useNotify';
|
|||
import { useTokenConfig } from './useTokenConfig';
|
||||
const TOKEN_MULTIMEDIA = 'tokenMultimedia';
|
||||
const TOKEN = 'token';
|
||||
|
||||
let router;
|
||||
export default {
|
||||
setup() {
|
||||
router = useRouter();
|
||||
},
|
||||
};
|
||||
export function useSession() {
|
||||
const router = useRouter();
|
||||
const { notify } = useNotify();
|
||||
let isCheckingToken = false;
|
||||
let intervalId = null;
|
||||
|
|
|
@ -14,8 +14,8 @@ import { useUserConfig } from 'src/composables/useUserConfig';
|
|||
import { useTokenConfig } from 'src/composables/useTokenConfig';
|
||||
import { useAcl } from 'src/composables/useAcl';
|
||||
|
||||
const state = useState();
|
||||
const session = useSession();
|
||||
let state, session;
|
||||
|
||||
const { t, te } = i18n.global;
|
||||
|
||||
const createHistory = process.env.SERVER
|
||||
|
@ -43,8 +43,10 @@ const Router = createRouter({
|
|||
* with the Router instance.
|
||||
*/
|
||||
export { Router };
|
||||
export default route(function (/* { store, ssrContext } */) {
|
||||
export default route((/* { store, ssrContext } */) => {
|
||||
Router.beforeEach(async (to, from, next) => {
|
||||
state = useState();
|
||||
session = useSession();
|
||||
const { isLoggedIn } = session;
|
||||
const outLayout = Router.options.routes[0].children.map((r) => r.name);
|
||||
if (!isLoggedIn() && !outLayout.includes(to.name)) {
|
||||
|
|
Loading…
Reference in New Issue