Fix automatic logout on authentication error
(yet another attempt)
This commit is contained in:
parent
e2c915a256
commit
2b9ded4a95
2 changed files with 6 additions and 5 deletions
|
@ -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.
|
- Show better error message if HTTP status code is 413.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed automatic logout on authentication error.
|
||||||
|
|
||||||
## [1.17.0] - 2023-03-15
|
## [1.17.0] - 2023-03-15
|
||||||
|
|
||||||
### Added
|
### 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 publishing of reply fails.
|
||||||
- Show alert if attachment upload fails.
|
- Show alert if attachment upload fails.
|
||||||
|
|
||||||
### Fixed
|
|
||||||
|
|
||||||
- Fixed automatic logout on authentication error.
|
|
||||||
|
|
||||||
## [1.16.0] - 2023-03-08
|
## [1.16.0] - 2023-03-08
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -26,7 +26,7 @@ import SidebarLayout from "@/components/SidebarLayout.vue"
|
||||||
import { useCurrentUser } from "@/store/user"
|
import { useCurrentUser } from "@/store/user"
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const { ensureAuthToken, ensureCurrentUser } = useCurrentUser()
|
const { endUserSession, ensureAuthToken, ensureCurrentUser } = useCurrentUser()
|
||||||
|
|
||||||
let posts = $ref<Post[]>([])
|
let posts = $ref<Post[]>([])
|
||||||
let isLoading = $ref(false)
|
let isLoading = $ref(false)
|
||||||
|
@ -47,6 +47,7 @@ async function loadTimeline() {
|
||||||
posts = await getHomeTimeline(authToken)
|
posts = await getHomeTimeline(authToken)
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
if (error.message === "access token is invalid") {
|
if (error.message === "access token is invalid") {
|
||||||
|
await endUserSession()
|
||||||
router.push({ name: "landing-page" })
|
router.push({ name: "landing-page" })
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue