Skip to content

Commit

Permalink
Merge pull request #381 from euanwm/feature/optimised_events_page
Browse files Browse the repository at this point in the history
optimised events page
  • Loading branch information
euanwm authored Jul 15, 2024
2 parents 4788397 + cf0cf7f commit 7422b3c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
13 changes: 3 additions & 10 deletions frontend/components/organisms/eventPage.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
import { useRouter } from 'next/router'
import HeaderBar from '@/components/molecules/head'
import { EventMetaData } from '@/api/fetchEventsList/fetchEventsListTypes'
import fetchEventResult from '@/api/fetchEventResult/fetchEventResult'
import useSWR from 'swr'
import { Spinner } from '@nextui-org/react'
import { EventTable } from '@/components/molecules/eventTable'
import {EventParams} from "@/pages/events/show";

function ShowEvent(){
const router = useRouter()
const params: { [key: string]: string } = {}
for (const key in router.query) {
params[key] = router.query[key]?.toString() || ''
}

function ShowEvent(params: EventParams | any){
const { data, isLoading } = useSWR(
params,
params.query,
fetchEventResult,
)

Expand Down
13 changes: 11 additions & 2 deletions frontend/pages/events/show.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
import ShowEvent from '@/components/organisms/eventPage'

function Event() {
return <ShowEvent />
function Event(props: EventParams) {
return <ShowEvent {...props} />
}

export interface EventParams {
[key: string]: string
}

export async function getServerSideProps(context: { query: EventParams }) {
const query = context.query
return { props: { query } }
}

export default Event

0 comments on commit 7422b3c

Please sign in to comment.