This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react' | |
| import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' | |
| import { faTimesCircle } from '@fortawesome/free-solid-svg-icons' | |
| export default props => | |
| props.images.map((image, i) => | |
| <div key={i} className='fadein'> | |
| <div | |
| onClick={() => props.removeImage(image.public_id)} | |
| className='delete' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app.post('/image-upload-single', (req, res) => { | |
| const path = Object.values(Object.values(req.files)[0])[0].path | |
| cloudinary.uploader.upload(path) | |
| .then(image => res.json([image])) | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Inside onChange handler | |
| // .... | |
| // #1 There are too many files! | |
| if (files.length > 3) { | |
| const msg = 'Only 3 images can be uploaded at a time' | |
| return this.toast(msg, 'custom', 2000, toastColor) | |
| } | |
| const types = ['image/png', 'image/jpeg', 'image/gif'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react' | |
| import { BrowserRouter, Route, Redirect, Switch } from 'react-router-dom' | |
| import Notifications from 'react-notify-toast' | |
| import 'react-toastify/dist/ReactToastify.css' | |
| import Landing from './components/Landing' | |
| import Confirm from './components/Confirm' | |
| import Spinner from './components/Spinner' | |
| import Footer from './components/Footer/Footer' | |
| import { API_URL } from './config' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react' | |
| import { notify } from 'react-notify-toast' | |
| import Spinner from './Spinner' | |
| import { API_URL } from '../config' | |
| export default class Landing extends Component { | |
| // A bit of state to give the user feedback while their email address is being | |
| // added to the User model on the server. | |
| state = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, {Component} from 'react' | |
| import { Link } from 'react-router-dom' | |
| import { notify } from 'react-notify-toast' | |
| import Spinner from './Spinner' | |
| import { API_URL } from '../config' | |
| export default class Confirm extends Component { | |
| // A bit of state to give the user feedback while their email | |
| // address is being confirmed on the User model on the server. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react' | |
| import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' | |
| import { faSync } from '@fortawesome/free-solid-svg-icons' | |
| export default props => | |
| <div className={`fadeIn ${props.spinning}`}> | |
| <FontAwesomeIcon icon={faSync} size={props.size} /> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require('dotenv').config() | |
| const express = require('express') | |
| const mongoose = require('mongoose') | |
| const cors = require('cors') | |
| const app = express() | |
| const emailController = require('./email/email.controller') | |
| const { PORT, CLIENT_ORIGIN, DB_URL } = require('./config') | |
| // Only allow requests from our client |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const User = require('../user.model') | |
| const sendEmail = require('./email.send') | |
| const msgs = require('./email.msgs') | |
| const templates = require('./email.templates') | |
| // The callback that is invoked when the user submits the form on the client. | |
| exports.collectEmail = (req, res) => { | |
| const { email } = req.body | |
| User.findOne({ email }) |