Skip to content
Snippets Groups Projects
Commit d861cda4 authored by Gregor Schulz's avatar Gregor Schulz
Browse files

invert filter logic for local

parent 83a730ef
No related branches found
No related tags found
No related merge requests found
...@@ -60,7 +60,7 @@ const toHoliEvent = (event: AppApiEvent): HoliEvent => { ...@@ -60,7 +60,7 @@ const toHoliEvent = (event: AppApiEvent): HoliEvent => {
} }
const buildJasdAppApiUrl = ( const buildJasdAppApiUrl = (
{ limit, offset, location, remoteOnly }: FetchEventsInput, { limit, offset, location, localOnly }: FetchEventsInput,
): URL => { ): URL => {
const url = new URL(`${APP_API_BASE_URL}/search`) const url = new URL(`${APP_API_BASE_URL}/search`)
url.searchParams.append('page', offset.toString()) url.searchParams.append('page', offset.toString())
...@@ -71,8 +71,10 @@ const buildJasdAppApiUrl = ( ...@@ -71,8 +71,10 @@ const buildJasdAppApiUrl = (
url.searchParams.append('includeExpiredActivities', 'false') url.searchParams.append('includeExpiredActivities', 'false')
url.searchParams.append('permanent', 'false') url.searchParams.append('permanent', 'false')
if (remoteOnly) { if (localOnly) {
url.searchParams.append('online', 'true') url.searchParams.append('online', 'false')
// true is returning only online events
// undefined is returning all
} }
if (location) { if (location) {
...@@ -128,8 +130,8 @@ const fetchEventsPage = async ( ...@@ -128,8 +130,8 @@ const fetchEventsPage = async (
export type FetchEventsInput = { export type FetchEventsInput = {
limit: number limit: number
offset: number offset: number
localOnly: boolean
location?: string location?: string
remoteOnly?: boolean
} }
export const fetchEvents = async ( export const fetchEvents = async (
......
...@@ -41,7 +41,7 @@ const SCHEMA = ` ...@@ -41,7 +41,7 @@ const SCHEMA = `
type Query { type Query {
# uses offset-based pagination as described in https://www.apollographql.com/docs/react/pagination/offset-based # uses offset-based pagination as described in https://www.apollographql.com/docs/react/pagination/offset-based
events(offset: Int = 0, limit: Int = 5, location: String, remoteOnly: Boolean): EventsResponse! events(offset: Int = 0, limit: Int = 5, location: String, localOnly: Boolean): EventsResponse!
event(id: String!): EventResponse! event(id: String!): EventResponse!
} }
` `
...@@ -50,7 +50,7 @@ export type EventsRequest = { ...@@ -50,7 +50,7 @@ export type EventsRequest = {
limit?: number limit?: number
offset?: number offset?: number
location?: string location?: string
remoteOnly?: boolean localOnly?: boolean
} }
export type EventRequest = { export type EventRequest = {
...@@ -69,7 +69,7 @@ const validateEventsRequestInput = (request: EventsRequest): FetchEventsInput => ...@@ -69,7 +69,7 @@ const validateEventsRequestInput = (request: EventsRequest): FetchEventsInput =>
limit: limit, limit: limit,
offset: request.offset ?? 0, offset: request.offset ?? 0,
location: request.location, location: request.location,
remoteOnly: request.remoteOnly, localOnly: request.localOnly ?? false,
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment