Coder Social home page Coder Social logo

john-raymon / vippyapp Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 6.12 MB

MERN app with Stripe Connect using Express accounts, Cloudinary uploads, JWT-based authentication and more

License: GNU General Public License v3.0

JavaScript 70.90% HTML 0.45% CSS 25.90% Shell 0.09% SCSS 2.66%

vippyapp's Introduction

VippyBeta

// TODO: README NEEDS TO BE UPDATED

Vippy BETA - Monolithic Fullstack MERN App

Look into .env.example for required environment variables

NODE_ENV=
SECRET=
STRIPE_SECRET_KEY=
STRIPE_PUBLISHABLE_KEY=
STRIPE_TEST_CLIENT_ID=
TWILIO_ACCOUNT_SECURITY_API_KEY=Authy production API key
CLOUDINARY_CLOUD_NAME=vippy
CLOUDINARY_API_KEY=
CLOUDINARY_API_SECRET=
GOOGLE_GEOCODING_API_KEY=

Table of Contents

Models

  • User
  • Host (These are venues)
  • Event
  • Listing
  • Reservation (These are purchased Listings—transactions)
  • Promoter (belong to a Host, have auth. capabilities, has different toggleable permissions controlled by Host—venue)

React Frontend

All request returning a promise made in the thunks/actions should be caught in the component dependent of it immeditaly. The userAgent should always be injected as a dependency of the thunk action creator.

export const login = (userCredentials, userAgent) => dispatch => {
  const body = {
    emailOrPhoneNumber: {
      email: userCredentials.email,
      phoneNumber: userCredentials.phoneNumber
    },
    password: userCredentials.password
  }
  return dispatch({
    type: "USER_LOGIN",
    payload: userAgent.login(body)
  })
}

This will return a promise. We aren't concerned with catching it in our thunk, instead we leave the catching as the responsibility of the caller, which I imagine may be coming from a method in a component.

    ...
    payload: userAgent.login(body)
    // Promise
    // .then(res => res)
    // .catch(err => err)
    ...

We use thunk actions creators in combination with redux-promise-middleware in order to create a seamless flow from the dispatch to the thunk making the request, and then to the store, which will handle dispatching different actions reflecting the status of the promise, allowing us to update state accordingly while we do some asynchronous stuff.

... // in thunk, creation action creator for dispatch being returned
  payload: something.makeRequestReturnAPromise.catch(res => { throw res.response.body.error.message }) // intercept, only return nested error message
...

vippyapp's People

Contributors

dependabot[bot] avatar john-raymon avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.