Skip to content
This repository was archived by the owner on Mar 9, 2021. It is now read-only.

Commit 1aac0fc

Browse files
vinaypuppalZubair Ahmed
authored andcommitted
fix #119 (#128)
1 parent ee16a86 commit 1aac0fc

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

pages/events.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ export default class Events extends React.Component {
5151
} else {
5252
throw new Error('Failed to retieve future events');
5353
}
54-
await this.setState({
54+
this.setState({
5555
pastEvents,
5656
futureEvents,
5757
fetchError: null,
5858
loading: false,
5959
});
6060
} catch (err) {
6161
console.log(err);
62-
await this.setState({
62+
this.setState({
6363
pastEvents: null,
6464
futureEvents: null,
6565
fetchError: err.message,
@@ -91,12 +91,16 @@ export default class Events extends React.Component {
9191
return (
9292
<div>
9393
{events.slice(0, loadLimit).map(event => {
94+
console.log(event);
9495
const regexForImageSrc = /<img.*?src="([^">]*\/([^">]*?))".*?>/g;
95-
const imageSrc = regexForImageSrc.exec(event.description);
96+
const imgs = regexForImageSrc.exec(event.description);
97+
const imageSrc = imgs
98+
? imgs[1]
99+
: event.featured_photo ? event.featured_photo.photo_link : imagePlaceholderURL;
96100
return (
97101
<EventCard
98102
key={event.id}
99-
image={imageSrc ? imageSrc[1] : imagePlaceholderURL}
103+
image={imageSrc}
100104
name={event.name}
101105
location={event.venue ? event.venue.name : 'Online'}
102106
online={!event.venue}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy