Browse Source

fix: no longer having permission to view last visited admin page would lead to admin being inaccessible

Kristian Vos 2 years ago
parent
commit
ae4948e4dc
1 changed files with 8 additions and 3 deletions
  1. 8 3
      frontend/src/main.ts

+ 8 - 3
frontend/src/main.ts

@@ -300,9 +300,14 @@ createSocket().then(async socket => {
 					!userAuthStore.hasPermission(
 						`${to.meta.permissionRequired}`
 					)
-				)
-					next({ path: "/" });
-				else if (to.meta.guestsOnly && userAuthStore.loggedIn)
+				) {
+					if (
+						to.path.startsWith("/admin") &&
+						to.path !== "/admin/songs"
+					)
+						next({ path: "/admin/songs" });
+					else next({ path: "/" });
+				} else if (to.meta.guestsOnly && userAuthStore.loggedIn)
 					next({ path: "/" });
 				else next();
 			};