diff --git a/js/src/apollo/utils.ts b/js/src/apollo/utils.ts
index d47680ba5..84ba969e9 100644
--- a/js/src/apollo/utils.ts
+++ b/js/src/apollo/utils.ts
@@ -104,6 +104,11 @@ export async function refreshAccessToken(
const refreshToken = localStorage.getItem(AUTH_REFRESH_TOKEN);
+ if (!refreshToken) {
+ console.debug("Refresh token not found");
+ return false;
+ }
+
console.log("Refreshing access token.");
try {
@@ -118,6 +123,7 @@ export async function refreshAccessToken(
return true;
} catch (err) {
+ console.debug("Failed to refresh token");
return false;
}
}
diff --git a/js/src/components/Event/EventBanner.vue b/js/src/components/Event/EventBanner.vue
index f2d429ab2..5e653725d 100644
--- a/js/src/components/Event/EventBanner.vue
+++ b/js/src/components/Event/EventBanner.vue
@@ -15,7 +15,7 @@ import LazyImageWrapper from "../Image/LazyImageWrapper.vue";
},
})
export default class EventBanner extends Vue {
- @Prop({ required: true, default: null, type: Object as PropType })
+ @Prop({ default: null, type: Object as PropType })
picture!: IMedia | null;
}
diff --git a/js/src/components/NavBar.vue b/js/src/components/NavBar.vue
index 44a892aef..834de6654 100644
--- a/js/src/components/NavBar.vue
+++ b/js/src/components/NavBar.vue
@@ -216,7 +216,7 @@ import RouteName from "../router/name";
loggedUser: {
query: USER_SETTINGS,
skip() {
- return this.currentUser.isLoggedIn === false;
+ return !this.currentUser || this.currentUser.isLoggedIn === false;
},
},
},
diff --git a/js/src/types/apollo.ts b/js/src/types/apollo.ts
deleted file mode 100644
index da8b84b34..000000000
--- a/js/src/types/apollo.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { ServerParseError } from "@apollo/client/link/http";
-import { ServerError } from "@apollo/client/link/utils";
-
-function isServerError(
- err: Error | ServerError | ServerParseError | undefined
-): err is ServerError {
- return !!err && (err as ServerError).statusCode !== undefined;
-}
-
-export { isServerError };
diff --git a/js/src/utils/auth.ts b/js/src/utils/auth.ts
index 2feb49244..4c61a87a5 100644
--- a/js/src/utils/auth.ts
+++ b/js/src/utils/auth.ts
@@ -95,14 +95,17 @@ export async function initializeCurrentActor(
}
export async function logout(
- apollo: ApolloClient
+ apollo: ApolloClient,
+ performServerLogout = true
): Promise {
- await apollo.mutate({
- mutation: LOGOUT,
- variables: {
- refreshToken: localStorage.getItem(AUTH_REFRESH_TOKEN),
- },
- });
+ if (performServerLogout) {
+ await apollo.mutate({
+ mutation: LOGOUT,
+ variables: {
+ refreshToken: localStorage.getItem(AUTH_REFRESH_TOKEN),
+ },
+ });
+ }
await apollo.mutate({
mutation: UPDATE_CURRENT_USER_CLIENT,
diff --git a/js/src/views/Event/Event.vue b/js/src/views/Event/Event.vue
index 31e4fe785..5ac44b715 100755
--- a/js/src/views/Event/Event.vue
+++ b/js/src/views/Event/Event.vue
@@ -592,6 +592,7 @@ import { eventMetaDataList } from "../../services/EventMetadata";
},
skip() {
return (
+ !this.currentActor.id ||
!this.event?.attributedTo ||
!this.event?.attributedTo?.preferredUsername
);
diff --git a/js/src/views/Home.vue b/js/src/views/Home.vue
index fe2110ff9..3aca6994d 100644
--- a/js/src/views/Home.vue
+++ b/js/src/views/Home.vue
@@ -372,7 +372,9 @@ import Subtitle from "../components/Utils/Subtitle.vue";
currentUser: CURRENT_USER_CLIENT,
loggedUser: {
query: USER_SETTINGS,
- fetchPolicy: "no-cache",
+ skip() {
+ return !this.currentUser || this.currentUser.isLoggedIn === false;
+ },
error() {
return null;
},
diff --git a/js/src/views/PageNotFound.vue b/js/src/views/PageNotFound.vue
index dc0412ad7..27fab110b 100644
--- a/js/src/views/PageNotFound.vue
+++ b/js/src/views/PageNotFound.vue
@@ -38,7 +38,7 @@
}}
-