Skip to content

Commit

Permalink
chnage params
Browse files Browse the repository at this point in the history
  • Loading branch information
pc-beast committed Mar 9, 2022
1 parent 633f88f commit 54b8c90
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,12 @@ export default function Index(props: Props): JSX.Element {
)
}

export async function getStaticProps() {
export async function getStaticProps(): Promise<any> {
const date = new Date().toISOString()

const [event, eventErr] = await fetcher(
'events',
`&filter=[{"and":[{"name":"state","op":"eq","val":"published"},{"name":"privacy","op":"eq","val":"public"},{"name":"is-featured","op":"eq","val":true}]},{"or":[{"name":"ends-at","op":"ge","val":"${date}"}]}]
&page[size]=6
&public=true
&sort=starts-at`
'filter=%5B%7B%22and%22%3A%5B%7B%22name%22%3A%22state%22%2C%22op%22%3A%22eq%22%2C%22val%22%3A%22published%22%7D%2C%7B%22name%22%3A%22privacy%22%2C%22op%22%3A%22eq%22%2C%22val%22%3A%22public%22%7D%2C%7B%22or%22%3A%5B%7B%22name%22%3A%22is-featured%22%2C%22op%22%3A%22eq%22%2C%22val%22%3Atrue%7D%2C%7B%22name%22%3A%22is-promoted%22%2C%22op%22%3A%22eq%22%2C%22val%22%3Atrue%7D%2C%7B%22and%22%3A%5B%7B%22name%22%3A%22logo-url%22%2C%22op%22%3A%22ne%22%2C%22val%22%3Anull%7D%2C%7B%22name%22%3A%22original-image-url%22%2C%22op%22%3A%22ne%22%2C%22val%22%3Anull%7D%2C%7B%22name%22%3A%22event-topic%22%2C%22op%22%3A%22ne%22%2C%22val%22%3Anull%7D%2C%7B%22name%22%3A%22event-sub-topic%22%2C%22op%22%3A%22ne%22%2C%22val%22%3Anull%7D%2C%7B%22name%22%3A%22event-type%22%2C%22op%22%3A%22ne%22%2C%22val%22%3Anull%7D%5D%7D%5D%7D%2C%7B%22name%22%3A%22is-sessions-speakers-enabled%22%2C%22op%22%3A%22eq%22%2C%22val%22%3Atrue%7D%2C%7B%22name%22%3A%22is-demoted%22%2C%22op%22%3A%22eq%22%2C%22val%22%3Afalse%7D%2C%7B%22name%22%3A%22speakers-call%22%2C%22op%22%3A%22has%22%2C%22val%22%3A%7B%22name%22%3A%22privacy%22%2C%22op%22%3A%22eq%22%2C%22val%22%3A%22public%22%7D%7D%2C%7B%22name%22%3A%22speakers-call%22%2C%22op%22%3A%22has%22%2C%22val%22%3A%7B%22name%22%3A%22starts-at%22%2C%22op%22%3A%22le%22%2C%22val%22%3A%222022-03-09T11%3A52%3A46.823Z%22%7D%7D%2C%7B%22name%22%3A%22speakers-call%22%2C%22op%22%3A%22has%22%2C%22val%22%3A%7B%22name%22%3A%22ends-at%22%2C%22op%22%3A%22ge%22%2C%22val%22%3A%222022-03-09T11%3A52%3A46.823Z%22%7D%7D%2C%7B%22name%22%3A%22speakers-call%22%2C%22op%22%3A%22has%22%2C%22val%22%3A%7B%22name%22%3A%22announcement%22%2C%22op%22%3A%22ne%22%2C%22val%22%3Anull%7D%7D%5D%7D%2C%7B%22or%22%3A%5B%7B%22name%22%3A%22ends-at%22%2C%22op%22%3A%22ge%22%2C%22val%22%3A%222022-03-09T11%3A52%3A46.822Z%22%7D%2C%7B%22name%22%3A%22starts-at%22%2C%22op%22%3A%22ge%22%2C%22val%22%3A%222022-03-09T11%3A52%3A46.822Z%22%7D%5D%7D%5D&include=event-topic%2Cevent-sub-topic%2Cevent-type%2Cspeakers-call&page%5Bsize%5D=6&public=true&sort=starts-at'
)
if (eventErr) {
console.error(eventErr)
Expand All @@ -76,9 +73,16 @@ export async function getStaticProps() {
}
const upcomingEvents = toCamelCase(upcomingEvent?.data)

const promotedGroupFilter = JSON.stringify([
{
name: 'is-promoted',
op: 'eq',
val: true,
},
])
const [group, groupErr] = await fetcher(
'groups',
'filter=[{"name":"is-promoted","op":"eq","val":true}]&include=user,follower&page[size]=3&public=true'
`filter=${promotedGroupFilter}&include=user,follower&page[size]=3&public=true`
)
if (groupErr) {
console.error(groupErr)
Expand Down

0 comments on commit 54b8c90

Please sign in to comment.