Skip to content

Commit f59c512

Browse files
author
Deniz
committed
remove console log, prettier format
1 parent 4af14e9 commit f59c512

File tree

1 file changed

+25
-24
lines changed
  • apps/profile-web/src/components/EventRegistration

1 file changed

+25
-24
lines changed

apps/profile-web/src/components/EventRegistration/index.tsx

+25-24
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import React, { useEffect, useState } from "react";
22
import { message } from "antd";
3-
import { useMeQuery,
4-
useEventsQuery,
5-
useAttendEventMutation,
6-
useRecordInterestMutation,
7-
Event as IEvent } from "../../generated/graphql";
8-
9-
const EventRegistration: React.FC<{match: any}> = ({match}: any) => {
3+
import {
4+
useMeQuery,
5+
useEventsQuery,
6+
useAttendEventMutation,
7+
useRecordInterestMutation,
8+
Event as IEvent
9+
} from "../../generated/graphql";
10+
11+
const EventRegistration: React.FC<{ match: any }> = ({ match }: any) => {
1012
//style sheets for output
1113
const divStyle = {
1214
margin: "auto",
@@ -37,12 +39,12 @@ const EventRegistration: React.FC<{match: any}> = ({match}: any) => {
3739
fontWeight: 100,
3840
fontStyle: "italic",
3941
}
40-
42+
4143
const {
4244
loading: userLoading,
4345
error: userError,
4446
}: any = useMeQuery();
45-
47+
4648
const {
4749
loading: eventLoading,
4850
error: eventError,
@@ -77,9 +79,9 @@ const EventRegistration: React.FC<{match: any}> = ({match}: any) => {
7779

7880
//once all mutations/queries are loaded, the actual attendance is tracked
7981
useEffect(() => {
80-
if(curEvents && attendEvent && result.data) {
81-
if(result.data.me.id !== null)
82-
if(getEventId(eventUrlKey) !== -1) {
82+
if (curEvents && attendEvent && result.data) {
83+
if (result.data.me.id !== null)
84+
if (getEventId(eventUrlKey) !== -1) {
8385
attendEvent({
8486
variables: {
8587
eventId: Number(getEventId(eventUrlKey))
@@ -103,10 +105,10 @@ const EventRegistration: React.FC<{match: any}> = ({match}: any) => {
103105
return -1;
104106
};
105107

106-
if(eventLoading || eventError || userLoading || userError)
108+
if (eventLoading || eventError || userLoading || userError)
107109
return <p>Loading...</p>
108110

109-
if(result.data == null || getEventId(eventUrlKey) == -1 || !attendEvent)
111+
if (result.data == null || getEventId(eventUrlKey) == -1 || !attendEvent)
110112
return (
111113
<div style={divStyle}>
112114
<p style={errorStyle}>An error has occured.</p>
@@ -124,7 +126,7 @@ const EventRegistration: React.FC<{match: any}> = ({match}: any) => {
124126
);
125127
};
126128

127-
const EventInterest: React.FC<{match: any}> = ({match}: any) => {
129+
const EventInterest: React.FC<{ match: any }> = ({ match }: any) => {
128130
//style sheets for output
129131
const divStyle = {
130132
margin: "auto",
@@ -155,12 +157,12 @@ const EventInterest: React.FC<{match: any}> = ({match}: any) => {
155157
fontWeight: 100,
156158
fontStyle: "italic",
157159
}
158-
160+
159161
const {
160162
loading: userLoading,
161163
error: userError,
162164
}: any = useMeQuery();
163-
165+
164166
const {
165167
loading: eventLoading,
166168
error: eventError,
@@ -175,7 +177,6 @@ const EventInterest: React.FC<{match: any}> = ({match}: any) => {
175177

176178
const onRecordInterestError: (e: Error) => void = (e: Error): void => {
177179
message.error("Upload failed. Please try again.");
178-
console.log(e);
179180
};
180181

181182
useEffect(() => {
@@ -200,17 +201,17 @@ const EventInterest: React.FC<{match: any}> = ({match}: any) => {
200201

201202
//once all mutations/queries are loaded, the actual attendance is tracked
202203
useEffect(() => {
203-
if(curEvents && recordInterest && result.data) {
204-
if(result.data.me.id !== null)
205-
if(getEventId(eventUrlKey) !== -1) {
204+
if (curEvents && recordInterest && result.data) {
205+
if (result.data.me.id !== null)
206+
if (getEventId(eventUrlKey) !== -1) {
206207
try {
207208
recordInterest({
208209
variables: {
209210
eventId: Number(getEventId(eventUrlKey))
210211
}
211212
});
212213
}
213-
catch(e) {
214+
catch (e) {
214215
onRecordInterestError(e);
215216
}
216217
}
@@ -231,10 +232,10 @@ const EventInterest: React.FC<{match: any}> = ({match}: any) => {
231232
return -1;
232233
};
233234

234-
if(eventLoading || eventError || userLoading || userError)
235+
if (eventLoading || eventError || userLoading || userError)
235236
return <p>Loading...</p>
236237

237-
if(result.data == null || getEventId(eventUrlKey) == -1 || !recordInterest)
238+
if (result.data == null || getEventId(eventUrlKey) == -1 || !recordInterest)
238239
return (
239240
<div style={divStyle}>
240241
<p style={errorStyle}>An error has occured.</p>

0 commit comments

Comments
 (0)