diff --git a/dashboard/src/pages/Group.svelte b/dashboard/src/pages/Group.svelte index 5f74b71c..46c8d5d3 100644 --- a/dashboard/src/pages/Group.svelte +++ b/dashboard/src/pages/Group.svelte @@ -2,7 +2,7 @@ import { Container, Row, Col, Alert, Spinner, Card, CardHeader, CardBody, Accordion, AccordionItem, CardTitle } from "sveltestrap"; import Body from '../lib/group/Body.svelte'; import MemberBody from '../lib/member/Body.svelte'; - import { useParams, Link } from 'svelte-navigator'; + import { useParams, Link, navigate } from 'svelte-navigator'; import { onMount } from 'svelte'; import api from "../api"; import { Member, Group } from "../api/types"; @@ -39,6 +39,11 @@ $: orderedMembers = members.sort((a, b) => a.name.localeCompare(b.name)); $: slicedMembers = orderedMembers.slice(indexOfFirstItem, indexOfLastItem); + if (!isPublic && isPage) { + let user = localStorage.getItem("pk-user"); + if (!user) navigate("/"); + } + onMount(() => { fetchGroup(); }); diff --git a/dashboard/src/pages/Member.svelte b/dashboard/src/pages/Member.svelte index e6e90a10..69aba683 100644 --- a/dashboard/src/pages/Member.svelte +++ b/dashboard/src/pages/Member.svelte @@ -2,7 +2,7 @@ import { Container, Row, Col, Alert, Spinner, Card, CardHeader, CardBody, Accordion, AccordionItem, CardTitle } from "sveltestrap"; import Body from '../lib/member/Body.svelte'; import GroupBody from '../lib/group/Body.svelte'; - import { useParams, Link } from 'svelte-navigator'; + import { useParams, Link, navigate } from 'svelte-navigator'; import { onMount } from 'svelte'; import api from "../api"; import { Member, Group } from "../api/types"; @@ -40,6 +40,11 @@ $: orderedGroups = groups.sort((a, b) => a.name.localeCompare(b.name)); $: slicedGroups = orderedGroups.slice(indexOfFirstItem, indexOfLastItem); + if (!isPublic && isPage) { + let user = localStorage.getItem("pk-user"); + if (!user) navigate("/"); + } + onMount(() => { fetchMember(); });