([])
useEffect(() => {
- storage.getTickets().then(setTickets)
- }, [])
+ storage.getAllTickets(isAuthenticated).then(setTickets)
+ }, [isAuthenticated])
const stats = {
total: tickets.length,
@@ -35,7 +39,9 @@ export function AdminPage() {
<>
Admin
-
All tickets across the system
+
+ {isAuthenticated ? 'All tickets across the system' : 'Your local tickets'}
+
diff --git a/frontend/src/pages/UserPage.tsx b/frontend/src/pages/UserPage.tsx
index 4dab831..7097c5e 100644
--- a/frontend/src/pages/UserPage.tsx
+++ b/frontend/src/pages/UserPage.tsx
@@ -6,14 +6,19 @@ import { NewTicketForm } from '../components/tickets/NewTicketForm.tsx'
import { useModal } from '../hooks/useModal.ts'
import { storage } from '../lib/storage.ts'
import type { Ticket } from '../lib/types.ts'
+import { PlusIcon } from '../components/icons/plus.tsx'
-export function UserPage() {
+interface UserPageProps {
+ isAuthenticated: boolean
+}
+
+export function UserPage({ isAuthenticated }: UserPageProps) {
const [tickets, setTickets] = useState([])
const newTicketModal = useModal()
useEffect(() => {
storage.getTickets().then(setTickets)
- }, [])
+ }, [isAuthenticated])
const handleCreate = async (form: Pick) => {
const ticket = await storage.createTicket(form)
@@ -36,9 +41,7 @@ export function UserPage() {