This file contains 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
var fs = require("fs"); | |
var browserify = require("browserify"); | |
browserify("./src/index.js") | |
.transform("babelify", {presets: ["es2015", "react"]}) | |
.bundle() | |
.pipe(fs.createWriteStream("./dist/bundle.js")); |
This file contains 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("babel-register"); | |
require("./app.js"); |
This file contains 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 Koa = require('koa') | |
const app = new Koa() | |
// trust proxy | |
app.proxy = true | |
// sessions | |
const convert = require('koa-convert') | |
const session = require('koa-generic-session') | |
app.keys = ['your-session-secret'] |
This file contains 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 Koa from 'koa' | |
import historyApiFallback from 'koa-connect-history-api-fallback' | |
const app = new Koa() | |
// trust proxy | |
app.proxy = true | |
// sessions | |
const convert = require('koa-convert') | |
const session = require('koa-generic-session') |
This file contains 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 Koa from 'koa' | |
import historyApiFallback from 'koa-connect-history-api-fallback' | |
const app = new Koa() | |
// trust proxy | |
app.proxy = true | |
// sessions | |
const convert = require('koa-convert') | |
const session = require('koa-generic-session') |
This file contains 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 AccountDetail from 'components/AccountDetail' | |
import CustomerForm from 'components/CustomerForm' | |
import CustomerPanel from 'components/CustomerPanel' | |
import SecurityPanel from 'components/SecurityPanel' | |
class Account extends React.Component { | |
constructor(props) { | |
super(props) | |
this.state = { |
This file contains 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 { test } from 'tap' | |
import configureMockStore from 'redux-mock-store' | |
import thunk from 'redux-thunk' | |
import { asyncChangeUser, loadUser, loadCreditCards } from '../actions' | |
import { | |
ACCOUNT_ENDPOINT, | |
ACCOUNT_EDIT_ENDPOINT, | |
STATUS_ENDPOINT, | |
CENTRE_ENDPOINT | |
} from 'utils/api' |
This file contains 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
export function loadUser(personId) { | |
return async (dispatch, getState) => { | |
dispatch({ type: LOAD_USER, payload: { personId } }) | |
try { | |
// Load account api | |
const accountResponse = await fetchAccount(personId) | |
dispatch(receivedAccount(personId, accountResponse)) | |
// Load status api | |
const email = accountResponse.data.email |
This file contains 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 Koa from 'koa' | |
import { createReadStream } from 'utils/fs' | |
import historyApiFallback from 'koa-connect-history-api-fallback' | |
import morgan from 'koa-morgan' | |
import responseCalls from './middleware/responseCalls' | |
import webpack from 'webpack' | |
import webpackConfig from '../../webpack.config.dev.babel' | |
import koaWebpackDevMiddleware from 'koa-webpack-dev-middleware' | |
import koaWebpackHotMiddleware from 'koa-webpack-hot-middleware' |
This file contains 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
export const LOAD_EMAIL_PREFERENCES = 'LOAD_EMAIL_PREFERENCES' | |
export const LOADED_EMAIL_PREFERENCES = 'LOADED_EMAIL_PREFERENCES' | |
export function loadEmailPreferences (personId) { | |
const emailPreferences = { newsletters: [] } | |
return async (dispatch, getState) => { | |
dispatch({ type: LOAD_EMAIL_PREFERENCES }) | |
const account = getState().guests[personId].account | |
const centres = account.newsletter_centre_ids | |
const subscriptions = account.newsletter_subscriptions | |
if (centres.length) { |