mirror of
https://github.com/pockethost/pockethost.git
synced 2025-07-03 11:22:29 +00:00
enh: removed public routes guards in dashboard
This commit is contained in:
parent
7a5dfa1c1c
commit
a4ca2985f6
@ -1,21 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { ROUTES } from '$src/constants'
|
||||
import { client } from '$src/pocketbase'
|
||||
import { getRouter } from '$util/utilities'
|
||||
import { LoggerService } from '@pockethost/common'
|
||||
import { onMount } from 'svelte'
|
||||
|
||||
onMount(() => {
|
||||
const { isLoggedIn } = client()
|
||||
if (isLoggedIn()) return
|
||||
const router = getRouter()
|
||||
|
||||
const { pathname } = router
|
||||
if (!ROUTES.find((matcher) => matcher.match(pathname))) {
|
||||
const { warn } = LoggerService()
|
||||
// Send user to the homepage
|
||||
warn(`${pathname} is a private route`)
|
||||
window.location.href = '/'
|
||||
}
|
||||
})
|
||||
</script>
|
@ -1,7 +1,3 @@
|
||||
import publicRoutes from '$util/public-routes.json'
|
||||
import UrlPattern from 'url-pattern'
|
||||
import base from '../../../package.json'
|
||||
|
||||
export const POCKETHOST_VERSION = base.version
|
||||
|
||||
export const ROUTES = publicRoutes.map((pattern) => new UrlPattern(pattern))
|
||||
|
@ -14,7 +14,6 @@
|
||||
</script>
|
||||
|
||||
<Meta />
|
||||
<Protect />
|
||||
|
||||
{#if $isUserLoggedIn}
|
||||
<div class="layout xl:flex">
|
||||
|
@ -1,9 +0,0 @@
|
||||
[
|
||||
"/",
|
||||
"/signup",
|
||||
"/login",
|
||||
"/login/password-reset",
|
||||
"/login/password-reset/confirm",
|
||||
"/login/confirm-account",
|
||||
"/faq"
|
||||
]
|
Loading…
x
Reference in New Issue
Block a user