@@ -472,8 +469,6 @@ const AdminDashboard = () => {
- ) : (
-
);
};
diff --git a/client/src/components/manageProjects/addProject.jsx b/client/src/components/manageProjects/addProject.jsx
index ddec883be..fa62cd9d4 100644
--- a/client/src/components/manageProjects/addProject.jsx
+++ b/client/src/components/manageProjects/addProject.jsx
@@ -2,7 +2,7 @@ import React from 'react';
import ProjectForm from '../ProjectForm';
import { simpleInputs } from '../data';
-function addProject() {
+function addProject({auth}) {
return (
);
diff --git a/client/src/hooks/withAuth.jsx b/client/src/hooks/withAuth.jsx
new file mode 100644
index 000000000..f846c6dec
--- /dev/null
+++ b/client/src/hooks/withAuth.jsx
@@ -0,0 +1,14 @@
+import { Redirect } from 'react-router-dom';
+import useAuth from './useAuth';
+
+const withAuth = (Component) => (props) => {
+ const { auth } = useAuth();
+
+ if (!auth) {
+ return
+ }
+
+ return
;
+}
+
+export default withAuth;
\ No newline at end of file
diff --git a/client/src/pages/Events.jsx b/client/src/pages/Events.jsx
index e2f83ec07..ecbebad47 100644
--- a/client/src/pages/Events.jsx
+++ b/client/src/pages/Events.jsx
@@ -1,13 +1,11 @@
import React, { useState, useEffect } from 'react';
-import { Link, Redirect } from 'react-router-dom';
+import { Link } from 'react-router-dom';
import moment from 'moment';
-import { REACT_APP_CUSTOM_REQUEST_HEADER as headerToSend} from '../utils/globalSettings';
+import { REACT_APP_CUSTOM_REQUEST_HEADER as headerToSend } from '../utils/globalSettings';
import '../sass/Events.scss';
-import useAuth from '../hooks/useAuth';
const Events = (props) => {
- const { auth } = useAuth();
const [events, setEvents] = useState([]);
const [eventSearchParam, setEventSearchParam] = useState('');
@@ -20,17 +18,17 @@ const Events = (props) => {
},
});
const resJson = await res.json();
-
+
setEvents(resJson);
} catch (error) {
alert(error);
}
}
-
+
fetchData();
}, []);
- return auth && auth.user ? (
+ return (
Filter:
{
{' '}
- {event.name}
- ({moment(event.date).format('ddd, MMM D @ h:mm a')})
+ {event.name}(
+ {moment(event.date).format('ddd, MMM D @ h:mm a')})
@@ -65,9 +63,7 @@ const Events = (props) => {
})}
- ) : (
-