Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fixed #8

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
node_modules
/hot
src/config/setup.js
public/js/main.js.map
public/js/main.js
server/data/data.json
/dump.rdb
app.env
app.env
Binary file removed public/images/1529559724734_image1.jpeg
Binary file not shown.
Binary file removed public/images/1529559826728_image2.jpeg
Binary file not shown.
Binary file removed public/images/1529560008596_image1.jpeg
Binary file not shown.
Binary file removed public/images/1529560137444_image2.jpeg
Binary file not shown.
Binary file added public/images/image01.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/image02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/image03.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/image04.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/image05.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<title>Meet-Up</title>
<meta name="google-signin-client_id" content="689254462441-12m3gtb3llr27d4u4pvf6n0je55h24lf.apps.googleusercontent.com">
<meta name="google-signin-client_id" content="842270765197-nobt2hcf8gqnkt63tqmk2ist1cdfefms.apps.googleusercontent.com">
</head>
<body>
<div id="root"></div>
Expand Down
4 changes: 2 additions & 2 deletions server/model/redis.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const redis = require('redis')
const url = require('url')
const {promisify} = require('util')

const redisURL = url.parse('redis://rediscloud:nW2uWZSh6dFJpKfDjqqkoRWCKOv5OEUD@redis-17508.c44.us-east-1-2.ec2.cloud.redislabs.com:17508')
const redisURL = url.parse(process.env.REDISCLOUD_URL)
const client = redis.createClient(redisURL.port, redisURL.hostname, {no_ready_check: true})
client.auth(redisURL.auth.split(':')[1])

Expand All @@ -20,5 +20,5 @@ const smembers = promisify(client.smembers).bind(client)
const lpop = promisify(client.lpop).bind(client)

module.exports = {
hmset, hget, lpush, lrange, lset, sadd, smembers, lpop
hmset, hget, lpush, lrange, lset, sadd, smembers, lpop, redisURL, client
}
9 changes: 4 additions & 5 deletions server/server.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
const express = require('express')
const bodyParser = require('body-parser')
const redis = require('redis')
const Redis = require('./model/redis')
const fs = require('fs')
const client = redis.createClient()
const session = require('express-session')
const RedisStore = require('connect-redis')(session)
const multer = require('multer')
Expand All @@ -13,15 +12,15 @@ const comment = require('./controller/comment')
const admin = require('./controller/admin')

const app = express()
const PORT = 3000
const PORT = process.env.PORT || 3000
const UPLOAD_DIR = './public/images'

const storage = multer.diskStorage({
destination: function (req, file, callback) {
callback(null, UPLOAD_DIR)
},
filename: function (req, file, callback) {
callback(null, Date.now() + '_' + file.originalname)
callback(null, file.originalname)
}
})

Expand All @@ -39,7 +38,7 @@ const upload = multer({ storage })

app.use(session({
secret: 'ssshhhhh',
store: new RedisStore({host: 'localhost', port: 6379, client: client, ttl: 260}),
store: new RedisStore({host: Redis.redisURL.hostname, port: Redis.redisURL.port, client: Redis.client, ttl: 260}),
saveUninitialized: false,
resave: false
}))
Expand Down
3 changes: 1 addition & 2 deletions src/components/admin/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, {Component} from 'react'
import {Route, Redirect} from 'react-router-dom'
import DashBoard from './dashboard'
import EventForm from '../eventForm'
import config from '../../config/index'
import http from '../../helper/http'

class Admin extends Component {
Expand All @@ -16,7 +15,7 @@ class Admin extends Component {
}

componentDidMount () {
http.post(`${config.url}api/admin/validate`, {'a': 'b'})
http.post(`api/admin/validate`, {'a': 'b'})
.then((response) => {
if (response.status === 200) {
this.setState({isAuthenticated: true})
Expand Down
5 changes: 2 additions & 3 deletions src/components/eventComments/comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import TextArea from '../../shared/textarea'
import Button from '../../shared/button'
import http from '../../helper/http'
import moment from 'moment'
import config from '../../config/index'

class Comments extends Component {
constructor (props) {
Expand All @@ -29,7 +28,7 @@ class Comments extends Component {

const obj = {message, email: profile.email, eventId}

http.post(`${config.url}api/event/comment`, obj)
http.post(`api/event/comment`, obj)
.then((response) => {
if (response.status === 200) {
this.handleReset()
Expand All @@ -50,7 +49,7 @@ class Comments extends Component {
const {eventId, eventDetails} = this.props
const obj = {commentId: comment.commentId, eventId}

http.delete(`${config.url}api/event/comment`, obj)
http.delete(`api/event/comment`, obj)
.then((response) => {
eventDetails()
})
Expand Down
3 changes: 1 addition & 2 deletions src/components/eventContainer/eventcontainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, {Component} from 'react'
import Carousel from '../../shared/carousel'
import EventList from './eventList'
import EventCard from '../eventCard'
import config from '../../config/index'
import http from '../../helper/http'

class EventContainer extends Component {
Expand All @@ -15,7 +14,7 @@ class EventContainer extends Component {
}

componentDidMount () {
http.get(`${config.url}api/event`)
http.get(`api/event`)
.then(response => response.json())
.then((events) => {
this.setState({events})
Expand Down
9 changes: 4 additions & 5 deletions src/components/eventDetails/eventdetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import Description from '../eventDescription/description'
import Attendees from '../eventAttendees/attendees'
import Comments from '../eventComments/comments'
import http from '../../helper/http'
import config from '../../config/index'
import PopUp from '../../shared/popup'
import GoogleOauth from '../googleOauth'
import EventConfirm from './eventconfirm'
Expand All @@ -31,7 +30,7 @@ class EventDetails extends Component {
}

getEventDetails () {
http.get(`${config.url}api/event/${this.props.match.params.id}`)
http.get(`api/event/${this.props.match.params.id}`)
.then(response => response.json())
.then((event) => {
const {isLocationLoaded} = this.state
Expand Down Expand Up @@ -67,7 +66,7 @@ class EventDetails extends Component {
let {profile} = this.props
if (profile.email) {
this.props.handleYes(false)
this.handleAttendee(profile, this.state.event.id, `${config.url}api/event/attendee`)
this.handleAttendee(profile, this.state.event.id, `api/event/attendee`)
}
}

Expand All @@ -92,7 +91,7 @@ class EventDetails extends Component {
handleCancelButtonClick () {
const {profile, handleYes} = this.props
handleYes(false)
this.handleAttendee(profile, this.state.event.id, `${config.url}api/event/attendee/cancel`)
this.handleAttendee(profile, this.state.event.id, `api/event/attendee/cancel`)
}

handleCloseClick () {
Expand All @@ -109,7 +108,7 @@ class EventDetails extends Component {
const {event} = this.state
const list = event.attendees.filter((attendee) => attendee.email === this.props.profile.email)[0]
if (!list && this.props.profile.email) {
this.handleAttendee(this.props.profile, event.id, `${config.url}api/event/attendee`)
this.handleAttendee(this.props.profile, event.id, `api/event/attendee`)
}
this.props.handleYes(false)
}
Expand Down
3 changes: 1 addition & 2 deletions src/components/eventForm/eventform.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {Redirect} from 'react-router-dom'
import Button from '../../shared/button'
import Input from '../../shared/input'
import TextArea from '../../shared/textarea'
import config from '../../config/index'
import DatePicker from 'react-datepicker'
import moment from 'moment'
import 'react-datepicker/dist/react-datepicker.min.css'
Expand Down Expand Up @@ -77,7 +76,7 @@ class EventForm extends Component {
formData.append('dateTime', date)
id && formData.append('id', id)

fetch(`${config.url}api/event`, {
fetch(`api/event`, {
method: isEditMode ? 'PUT' : 'POST',
credentials: 'same-origin',
body: formData
Expand Down
2 changes: 1 addition & 1 deletion src/components/googleOauth/googleOauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class GoogleOauth extends Component {

init () {
const params = {
client_id: '689254462441-12m3gtb3llr27d4u4pvf6n0je55h24lf.apps.googleusercontent.com',
client_id: '842270765197-nobt2hcf8gqnkt63tqmk2ist1cdfefms.apps.googleusercontent.com',
cookie_policy: 'single_host_origin',
fetch_basic_profile: true,
ux_mode: 'popup',
Expand Down
3 changes: 1 addition & 2 deletions src/components/logout/logout.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, {Component} from 'react'
import {withRouter} from 'react-router-dom'
import Button from '../../shared/button'
import config from '../../config/index'
import http from '../../helper/http'

class Logout extends Component {
Expand All @@ -18,7 +17,7 @@ class Logout extends Component {

}
onClick () {
http.delete(`${config.url}api/user/logout`, {})
http.delete(`api/user/logout`, {})
.then(() => {
console.log('logout')
this.signOut()
Expand Down
3 changes: 1 addition & 2 deletions src/components/mainContainer/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { HashRouter, Route, Switch } from 'react-router-dom'
import Content from '../content'
import Header from '../header'
import EventDetails from '../eventDetails'
import config from '../../config/index'
import http from '../../helper/http'
import Admin from '../admin'
import Profile from '../profile'
Expand Down Expand Up @@ -42,7 +41,7 @@ class Main extends Component {
display: true,
aboutme: ''
}
http.post(`${config.url}api/user/get`, data)
http.post(`api/user/get`, data)
.then(response => {
response.json().then(profileinfo => {
if (profileinfo === null) {
Expand Down
3 changes: 1 addition & 2 deletions src/components/profile/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {Redirect} from 'react-router-dom'
import Button from '../../shared/button'
import Input from '../../shared/input'
import TextArea from '../../shared/textarea'
import config from '../../config/index'
import http from '../../helper/http'

class Profile extends Component {
Expand All @@ -26,7 +25,7 @@ class Profile extends Component {
aboutme: e.target.aboutme.value,
display: this.state.checkbox
})
http.post(`${config.url}api/user/login`, data)
http.post(`api/user/login`, data)
.then((response) => {
if (response.status === 200) {
this.props.handleFirst()
Expand Down
3 changes: 0 additions & 3 deletions src/config/index.js

This file was deleted.