feat: common changes for site protection (#3878)
This commit is contained in:
@@ -994,5 +994,10 @@
|
|||||||
"personal": "My Workspace",
|
"personal": "My Workspace",
|
||||||
"team": "Team Workspace",
|
"team": "Team Workspace",
|
||||||
"title": "Workspaces"
|
"title": "Workspaces"
|
||||||
|
},
|
||||||
|
"site_protection": {
|
||||||
|
"login_to_continue": "Login to continue",
|
||||||
|
"login_to_continue_description": "You need to be logged in to access this Hoppscotch Enterprise Instance.",
|
||||||
|
"error_fetching_site_protection_status": "Something Went Wrong While Fetching Site Protection Status"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ export type HoppModule = {
|
|||||||
to: RouteLocationNormalized,
|
to: RouteLocationNormalized,
|
||||||
from: RouteLocationNormalized,
|
from: RouteLocationNormalized,
|
||||||
router: Router
|
router: Router
|
||||||
) => void
|
) => void | Promise<void>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called by the router to tell all the modules that a route navigation has completed
|
* Called by the router to tell all the modules that a route navigation has completed
|
||||||
|
|||||||
@@ -47,15 +47,21 @@ export default <HoppModule>{
|
|||||||
routes,
|
routes,
|
||||||
})
|
})
|
||||||
|
|
||||||
router.beforeEach((to, from) => {
|
router.beforeEach(async (to, from) => {
|
||||||
_isLoadingInitialRoute.value = isInitialRoute(from)
|
_isLoadingInitialRoute.value = isInitialRoute(from)
|
||||||
|
|
||||||
|
const onBeforeRouteChangePromises: Promise<any>[] = []
|
||||||
|
|
||||||
HOPP_MODULES.forEach((mod) => {
|
HOPP_MODULES.forEach((mod) => {
|
||||||
mod.onBeforeRouteChange?.(to, from, router)
|
const res = mod.onBeforeRouteChange?.(to, from, router)
|
||||||
|
if (res) onBeforeRouteChangePromises.push(res)
|
||||||
})
|
})
|
||||||
platform.addedHoppModules?.forEach((mod) => {
|
platform.addedHoppModules?.forEach((mod) => {
|
||||||
mod.onBeforeRouteChange?.(to, from, router)
|
const res = mod.onBeforeRouteChange?.(to, from, router)
|
||||||
|
if (res) onBeforeRouteChangePromises.push(res)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
await Promise.all(onBeforeRouteChangePromises)
|
||||||
})
|
})
|
||||||
|
|
||||||
// Instead of this a better architecture is for the router
|
// Instead of this a better architecture is for the router
|
||||||
|
|||||||
@@ -44,4 +44,5 @@ export default defineComponent({
|
|||||||
<route lang="yaml">
|
<route lang="yaml">
|
||||||
meta:
|
meta:
|
||||||
layout: empty
|
layout: empty
|
||||||
|
onlyGuest: true
|
||||||
</route>
|
</route>
|
||||||
|
|||||||
Reference in New Issue
Block a user