Skip to content

Commit f2827d4

Browse files
BenjaminCharmesml-evs
authored andcommitted
Redirect non-authenticated users to About page
1 parent a40cc83 commit f2827d4

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

webapp/src/router/index.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,17 @@ const router = createRouter({
102102
routes,
103103
});
104104

105-
router.beforeEach((to, from, next) => {
105+
router.beforeEach(async (to, from, next) => {
106+
if (to.path === "/" || (to.name === "samples" && from.path === "/")) {
107+
const { getUserInfo } = await import("@/server_fetch_utils.js");
108+
const user = await getUserInfo();
109+
110+
if (!user) {
111+
next("/about");
112+
return;
113+
}
114+
}
115+
106116
const websiteTitle = process.env.VUE_APP_WEBSITE_TITLE || "datalab";
107117

108118
const capitalizeFirstLetter = (string) => {

0 commit comments

Comments
 (0)