From 2b9ded4a9546107797794a575794175f85ac5f72 Mon Sep 17 00:00:00 2001 From: silverpill Date: Sun, 19 Mar 2023 23:06:24 +0000 Subject: [PATCH] Fix automatic logout on authentication error (yet another attempt) --- CHANGELOG.md | 8 ++++---- src/views/HomeTimeline.vue | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a5c1257..fcdea3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Show better error message if HTTP status code is 413. +### Fixed + +- Fixed automatic logout on authentication error. + ## [1.17.0] - 2023-03-15 ### Added @@ -25,10 +29,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Show alert if publishing of reply fails. - Show alert if attachment upload fails. -### Fixed - -- Fixed automatic logout on authentication error. - ## [1.16.0] - 2023-03-08 ### Added diff --git a/src/views/HomeTimeline.vue b/src/views/HomeTimeline.vue index 9fccba8..d380671 100644 --- a/src/views/HomeTimeline.vue +++ b/src/views/HomeTimeline.vue @@ -26,7 +26,7 @@ import SidebarLayout from "@/components/SidebarLayout.vue" import { useCurrentUser } from "@/store/user" const router = useRouter() -const { ensureAuthToken, ensureCurrentUser } = useCurrentUser() +const { endUserSession, ensureAuthToken, ensureCurrentUser } = useCurrentUser() let posts = $ref([]) let isLoading = $ref(false) @@ -47,6 +47,7 @@ async function loadTimeline() { posts = await getHomeTimeline(authToken) } catch (error: any) { if (error.message === "access token is invalid") { + await endUserSession() router.push({ name: "landing-page" }) return } else {