This repository was archived by the owner on Mar 9, 2021. It is now read-only.
File tree 1 file changed +8
-4
lines changed
1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -51,15 +51,15 @@ export default class Events extends React.Component {
51
51
} else {
52
52
throw new Error ( 'Failed to retieve future events' ) ;
53
53
}
54
- await this . setState ( {
54
+ this . setState ( {
55
55
pastEvents,
56
56
futureEvents,
57
57
fetchError : null ,
58
58
loading : false ,
59
59
} ) ;
60
60
} catch ( err ) {
61
61
console . log ( err ) ;
62
- await this . setState ( {
62
+ this . setState ( {
63
63
pastEvents : null ,
64
64
futureEvents : null ,
65
65
fetchError : err . message ,
@@ -91,13 +91,17 @@ export default class Events extends React.Component {
91
91
return (
92
92
< div >
93
93
{ events . slice ( 0 , loadLimit ) . map ( event => {
94
+ console . log ( event ) ;
94
95
const regexForImageSrc = / < i m g .* ?s r c = " ( [ ^ " > ] * \/ ( [ ^ " > ] * ?) ) " .* ?> / 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 ;
96
100
return (
97
101
< EventCard
98
102
showImg
99
103
key = { event . id }
100
- image = { imageSrc ? imageSrc [ 1 ] : imagePlaceholderURL }
104
+ image = { imageSrc }
101
105
name = { event . name }
102
106
location = { event . venue ? event . venue . name : 'Online' }
103
107
online = { ! event . venue }
You can’t perform that action at this time.
0 commit comments