From 06a1ff6f4bea4cc7447d528423de54f14583dca4 Mon Sep 17 00:00:00 2001 From: kolaente Date: Sat, 1 Apr 2023 14:19:28 +0200 Subject: [PATCH] chore: reduce nesting --- src/router/index.ts | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/router/index.ts b/src/router/index.ts index 64f0ee1c8..17e5c9f1e 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -489,17 +489,14 @@ router.beforeEach(async (to, from) => { if(from.hash && from.hash.startsWith(LINK_SHARE_HASH_PREFIX)) { to.hash = from.hash } - - if (to.hash.startsWith(LINK_SHARE_HASH_PREFIX)) { - const currentAuthToken = getToken() - if (currentAuthToken === null) { - saveLastVisited(to.name as string, to.params, to.query) - return { - name: 'link-share.auth', - params: { - share: to.hash.replace(LINK_SHARE_HASH_PREFIX, ''), - }, - } + + if (to.hash.startsWith(linkShareHashPrefix) && getToken() === null) { + saveLastVisited(to.name as string, to.params, to.query) + return { + name: 'link-share.auth', + params: { + share: to.hash.replace(LINK_SHARE_HASH_PREFIX, ''), + }, } }