Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface EventQueryParams

Available filtering parameters for events. These can be used to fetch specific events, e.g. on a certain date, etc.

When specifying these parameters, only the date part is interesting. This means that you do not need to account for the hour, minute, etc. The specified date(s) will automatically be converted into the correct format, so you can safely pass in a full date using e.g. new Date().

before and after may be specified at the same time, but date will always take precedence. If date is specified, before and after will be ignored.

Note that excludeOids will not have any effect if oid (first parameter) is set.

example

Fetching events that occurs on a date

// Fetch all events that occurs today.
// Note that the date will be automatically converted into the
// correct timezone when parsed at the server (UTC+2).
const { data } = useEvents(null, { date: new Date() })
example

Fetching events that occurs after a specified date

// Fetches all events that occurs after today (not including today).
const { data } = useEvents(null, { after: new Date() })
example

Fetch events for a single nation

// Fetches events that is created by nation with oid 400
const { data } = useEvents(400)

// Of course, you may still specify query parameters:
const { data } = useEvents(400, { page: 2, amount: 5, after: new Date() })
example

Passing in the selected nation as a state variable (or prop) const [oid, setOid] = useState(null) const { data } = useEvent(oid, { date: new Date() })


@example Exclude events from selected nations
```javascript
// Fetches events that is not created by the nations with oid 400 and 405
const { data } = useEvents(null, { after: new Date(), excludeOids: [400, 405] })

@example Exclude events with selected categories

// Fetches events that is not of categories with ids 1, 2 or 3
const { data } = useEvents(null, { excludeCategories: [1, 2, 3] })

@example Fetch events for single category

// Fetches events that has category with id 1
const { data } = useEvents(null, { category: 1 })

@example Fetch events that is only open for students

// You can also set it to false to only include events that
// does not require you to be a student.
const { data } = useEvents(null, { onlyStudents: true })

@example Fetch events that is only open if you are a member of the nation

// You can also set it to false to only include events that
// does not require you to be a member of the nation
const { data } = useEvents(null, { onlyMembers: true })

Hierarchy

Index

Properties

Optional after

after: Date

Optional amount

amount: number

Optional before

before: Date

Optional category

category: number

Optional date

date: Date

Optional excludeCategories

excludeCategories: number[]

Optional excludeOids

excludeOids: number[]

Optional onlyMembers

onlyMembers: boolean

Optional onlyStudents

onlyStudents: boolean

Optional page

page: number

Generated using TypeDoc