Skip to content

Commit

Permalink
Firebase Refactor (#44)
Browse files Browse the repository at this point in the history
* fix returns to be objects instead of queries

* separation of functions initial

* setup temp

* removed withFirebase completely

* fix imports and remove extra
  • Loading branch information
ericke8 authored and godwinpang committed Mar 13, 2021
1 parent c17a69d commit 0234613
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 24 deletions.
1 change: 0 additions & 1 deletion src/pages/App/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import Loading from '../../components/Loading';
import NavBar from '../../components/NavBar';
import * as ROUTES from '../../constants/routes';
import AuthUserContext from '../../contexts';
import EventEdit from '../EventEditPage/event_edit';

// PrivateRoute can be used just like a normal Route from react-router-dom
// With a PrivateRoute, if the user is not logged in then they will be
Expand Down
24 changes: 1 addition & 23 deletions src/services/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,4 @@ const getPoints = () => {
throw Error('Points Query failed, userId invalid');
};

const getEventDetails = eventId => {
return firebase
.firestore()
.collection('events')
.doc(eventId)
.get()
.then(querySnapshot => {
return querySnapshot.data();
})
.catch(() => {
throw Error('Event Detail Query failed.');
});
};

const setEventDetails = (eventId, eventDetails) => {
return firebase
.firestore()
.collection('events')
.doc(eventId)
.set(eventDetails);
};

export { getUserEvent, getPoints, getEventDetails, setEventDetails };
export { getUserEvent, getPoints };

0 comments on commit 0234613

Please sign in to comment.