-
Notifications
You must be signed in to change notification settings - Fork 323
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
Cashay #64
Cashay #64
Changes from 3 commits
12775e2
fee20b5
a818f32
bd2a5e9
c7822ed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import {HTTPTransport} from 'cashay'; | ||
import {getGraphQLUri} from 'universal/utils/graphQLConfig'; | ||
|
||
export default class ActionHTTPTransport extends HTTPTransport { | ||
constructor(authToken) { | ||
super(); | ||
this.uri = getGraphQLUri(); | ||
this.init = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${authToken}` | ||
} | ||
}; | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👏 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import {render} from 'react-dom'; | ||
import React from 'react'; | ||
import { AppContainer } from 'react-hot-loader'; | ||
import {AppContainer} from 'react-hot-loader'; | ||
import {Map as iMap, fromJS} from 'immutable'; | ||
import {Cashay, HTTPTransport} from 'cashay'; | ||
import {cashay} from 'cashay'; | ||
import ActionHTTPTransport from './ActionHTTPTransport'; | ||
import makeStore from './makeStore'; | ||
import Root from './Root'; | ||
import {getGraphQLUri} from 'universal/utils/graphQLConfig'; | ||
import {localStorageVars} from 'universal/utils/clientOptions'; | ||
|
||
const {auth, routing, form} = window.__INITIAL_STATE__; // eslint-disable-line no-underscore-dangle | ||
|
@@ -17,35 +17,31 @@ const initialState = iMap([ | |
['form', form] | ||
]); | ||
|
||
// const authToken = localStorage.getItem(authTokenName); | ||
|
||
if (authToken) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can clean up here or in next PR (likely tomorrow) |
||
|
||
} | ||
// Create the store: | ||
const store = makeStore(initialState); | ||
|
||
// Create the Cashay singleton: | ||
const cashaySchema = require('cashay!../server/utils/getCashaySchema.js'); | ||
const authToken = localStorage.getItem(localStorageVars.authTokenName); | ||
const cashayHttpTransport = new HTTPTransport( | ||
getGraphQLUri(), | ||
{ | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${authToken}` | ||
} | ||
} | ||
); | ||
const cashayParams = { | ||
|
||
const cashayHttpTransport = new ActionHTTPTransport(authToken); | ||
|
||
cashay.create({ | ||
store, | ||
schema: cashaySchema, | ||
getToState: reduxStore => reduxStore.getState().get('cashay'), | ||
transport: cashayHttpTransport | ||
}; | ||
|
||
// export the Cashay singleton: | ||
export const cashay = new Cashay(cashayParams); | ||
}); | ||
|
||
|
||
render( | ||
<AppContainer> | ||
<Root store={store} /> | ||
<Root store={store}/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style note: I like the space before /. For me, makes it clearer to see. You opposed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Webstorm doesn't have that rule specific to self-closing tags, so the space would apply to everything eg There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I promise you, imma going to give Webstorm a try one of these days. We'll use your style (no space) and I'll rely on the linter more heavily than my 👀 |
||
</AppContainer>, | ||
document.getElementById('root') | ||
); | ||
|
@@ -57,10 +53,10 @@ if (module.hot) { | |
const Root = require('./Root'); | ||
render( | ||
<AppContainer> | ||
<Root store={store} /> | ||
<Root store={store}/> | ||
</AppContainer>, | ||
document.getElementById('root') | ||
); | ||
/* eslint-enable global-require */ | ||
/* eslint-enable global-require */ | ||
}); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,6 @@ require('babel-polyfill'); | |
const {transformSchema} = require('cashay'); | ||
const graphql = require('graphql').graphql; | ||
const rootSchema = require('../graphql/rootSchema'); | ||
const r = require('../database/rethinkDriver'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I ran into trouble here when using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we can comment out the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll think about it post merge… Sent with Mixmax On Wed, Jun 15, 2016 6:55 PM, Matt Krick notifications@github.com wrote: � we can comment out the const r... like we do the line below it. perhaps we should think of a way to use — Jordan @jrhusney / 612.227.5673 |
||
// r.getPoolMaster().drain(); | ||
module.exports = transformSchema(rootSchema, graphql); |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these slow me down! ditching uglify makes dev much more fun. maybe we should write a separate
deploy
script?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just use
npm run dev
and leavebuild:client
andbuild:server
alone?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i use
npm run bs
when working on the server. that way, i don't need to rebuild the client for every change i make to the server.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see! Seems like adding
build:deploy
might be the way to go then.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I can do that later)