Remove apollo link state

This commit is contained in:
Chocobozzz
2019-08-12 16:04:16 +02:00
parent 3fa2bd35d8
commit 6d221212ef
22 changed files with 415 additions and 148 deletions

View File

@@ -1,13 +1,13 @@
import { NavigationGuard } from 'vue-router';
import { UserRouteName } from '@/router/user';
import { LoginErrorCode } from '@/types/login-error-code.model';
import { AUTH_TOKEN } from '@/constants';
import { AUTH_ACCESS_TOKEN } from '@/constants';
export const authGuardIfNeeded: NavigationGuard = async function (to, from, next) {
if (to.meta.requiredAuth !== true) return next();
// We can't use "currentUser" from apollo here because we may not have loaded the user from the local storage yet
if (!localStorage.getItem(AUTH_TOKEN)) {
if (!localStorage.getItem(AUTH_ACCESS_TOKEN)) {
return next({
name: UserRouteName.LOGIN,
query: {