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(); | |
module.exports = { | |
secret: process.env.JWT_KEY, | |
FACEBOOK_APP_ID: process.env.FACEBOOK_APP_ID, | |
FACEBOOK_APP_SECRET: process.env.FACEBOOK_APP_SECRET, | |
TESTACCESSTOKEN: process.env.TESTACCESSTOKEN, | |
}; |
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 passport = require('passport'); | |
const FacebookTokenStrategy = require('passport-facebook-token'); | |
const LocalStrategy = require('passport-local').Strategy; | |
const JwtStrategy = require('passport-jwt').Strategy; | |
const ExtractJWT = require('passport-jwt').ExtractJwt; | |
const UserModel = require('../database/models/').Customer; | |
const secret = require('./jwtConfig'); | |
const { FACEBOOK_APP_ID } = require('./jwtConfig'); |
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, { useEffect } from 'react'; | |
import './App.css'; | |
import { Provider } from 'react-redux'; | |
import Calculator from './components/Calculator'; | |
import store from './redux/reduxCalculator'; | |
import reduxActions from './redux/reduxActions'; | |
s | |
/** | |
* Main entry to the application where the Redux Store is injected | |
*/ |
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 { createStore } from 'redux'; | |
import reduxActions from './reduxActions'; | |
// A reducer takes two arguments, the current state and an action. | |
const calculatorStore = (state = reduxActions.clearAns(), action) => { | |
switch (action.type) { | |
case 'EQUAL': | |
// Returns a new object instead of mutating the original object. | |
return { | |
...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
/** | |
* The action objects which are functions that return plain Javascript objects | |
*/ | |
const setEqual = (exp) => { | |
const str = `${exp}=`; | |
return { | |
type: 'EQUAL', | |
answer: str |
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'; | |
const Calculator = props => { | |
return ( | |
<div className="Calculator"> | |
<h1> A Simple Calculator</h1> | |
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 './App.css'; | |
import Calculator from './components/ Calculator'; | |
function App() { | |
return ( | |
<div className="App"> | |
<header className="App-header"> | |
<Calculator /> |
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
<WebView | |
ref={ref => (this.webview = ref)} | |
source={{uri: currentSite}} | |
style={{height:550}} | |
scrollEnabled={true} | |
startInLoadingState={true} | |
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 { ShoppingCart, Product, Order, OrderDetail } from '../database/models'; | |
const passport = require('passport'); | |
const jwt = require('jsonwebtoken'); | |
const secret = require('../config/jwtConfig'); | |
const db = require('../database/models/index'); | |
/** | |
* create an order from a cart |
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
let transaction; | |
try { | |
// get transaction | |
transaction = await sequelize.transaction(); | |
// step 1 | |
await Model.destroy({where: {id}, transaction}); | |
// step 2 |