enh: removed public routes guards in dashboard

This commit is contained in:
Ben Allfree 2023-10-18 10:43:15 -07:00
parent 7a5dfa1c1c
commit a4ca2985f6
4 changed files with 0 additions and 35 deletions

View File

@ -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>

View File

@ -1,7 +1,3 @@
import publicRoutes from '$util/public-routes.json'
import UrlPattern from 'url-pattern'
import base from '../../../package.json' import base from '../../../package.json'
export const POCKETHOST_VERSION = base.version export const POCKETHOST_VERSION = base.version
export const ROUTES = publicRoutes.map((pattern) => new UrlPattern(pattern))

View File

@ -14,7 +14,6 @@
</script> </script>
<Meta /> <Meta />
<Protect />
{#if $isUserLoggedIn} {#if $isUserLoggedIn}
<div class="layout xl:flex"> <div class="layout xl:flex">

View File

@ -1,9 +0,0 @@
[
"/",
"/signup",
"/login",
"/login/password-reset",
"/login/password-reset/confirm",
"/login/confirm-account",
"/faq"
]