Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var How = require("./How");
var What = require("./What");
var Product = require("./Product");
var Careers = require("./Careers");
var Job = require("./Job");
var NotFound = require("./NotFound");
var StyleguideBase = require("./styleguide/Base");
var StyleguideCaseStudy = require("./styleguide/CaseStudy");
// The eslint config below is needed for a jsx block that exists outside a
// React.CreateElement
/* eslint-disable no-unused-vars */
var React = require("react");
var Route = Router.Route;
var DefaultRoute = Router.DefaultRoute;
var NotFoundRoute = Router.NotFoundRoute;
/*eslint-enable no-unused-vars */
/* eslint-disable no-undef */
var routes = (
describe('renders correct component', () => {
const history = createMemoryHistory('/');
const store = createStore(veteran);
let tree;
before(() => {
// It's perfectly fine in this test to reuse the rendered component. Do that
// cause it cuts the test time from 1s down to ~0.1s.
tree = SkinDeep.shallowRender((
{routes}
), {
store // Mock the Redux store context so components render.
}
);
var React = require('react');
var ReactRouter = require('react-router');
var Router = ReactRouter.Router;
var IndexRedirect = ReactRouter.IndexRedirect;
var Route = ReactRouter.Route;
var Redirect = ReactRouter.Redirect;
var IndexRoute = ReactRouter.IndexRoute;
var config = require('../config/config');
var SUPPORTED_LOCALES = config.SUPPORTED_LOCALES;
var MAKER_PARTY_LOCALES = config.MAKER_PARTY_LOCALES;
// verify we have at least one locale
if (SUPPORTED_LOCALES.length === 0) {
console.error("No locales were loaded into routes.jsx, no routes can be built!");
process.exit(1);
}
}
});
console.log(that.state.userLocation);
});
}
},
getInitialState: function(){
return {
outletData: [],
outletTable: 'hello',
userLocation: {}
};
},
mixins: [Router.Navigation], //makes the router navigation information available for use (need this for redirection)
componentDidMount: function() {
this.getLocation();
FooterCheck.checker();
var that = this;
// TODO: change function so that it retrieves only outlets near users location
outletStore.getOutlets().then(function(outletData){
outletData.map(function(outlet){
userStore.getUsernameById(outlet.id).then(function(user){
console.log(user.username)
outlet['seller'] = user.username;
that.setState({outletData: outletData});
});
});
});
},
server.get('*', (req, res) => {
const store = configureStore({
sourceRequest: {
protocol: req.headers['x-forwarded-proto'] || req.protocol,
host: req.headers.host
}
})
const routes = createRoutes(store)
const history = createMemoryHistory(req.originalUrl)
const { dispatch } = store
match({ routes, history}, (err, redirectLocation, renderProps) => {
if (err) {
console.error(err)
return res.status(500).send('Internal server error')
}
if (!renderProps) {
return res.status(404).send('Not found')
}
const { components } = renderProps
// Define locals to be provided to all lifecycle hooks:
const locals = {
handleClose() {
browserHistory.push(
`/settlements/${this.props.params.oid}/survivors/${this.props.params
.survivorId}`
);
}
// Handle's the save and makes the API Call
// update store
yield put({
type: USER_LOGGED_IN,
payload: newUser,
})
// change route to newsfeed (or to redirect url)
let currentLocation = browserHistory.getCurrentLocation()
if ('redirect' in currentLocation.query) {
yield browserHistory.push(decodeURIComponent(currentLocation.query.redirect))
} else {
yield browserHistory.push('/newsfeed')
}
} catch (error) {}
} else {
yield browserHistory.push('/signup')
}
}
addActivity(activityData) {
if (activityData.acf.special_content !== 'findrep' && activityData.acf.special_content !== 'elections') {
this.props.addUserActivity(activityData);
browserHistory.push('/');
} else {
switch (activityData.acf.special_content) {
case 'findrep':
this.props.lookForReps(activityData);
browserHistory.push('/find-representative');
break;
case 'elections':
// do something
break;
default:
// do something by default
}
}
}
_yearChanged(event) {
// Reset postion to first page when changing the year
const year = parseInt(event.target.value, 0)
const state = Object.assign({}, this.state, {position: 0, year})
this.setState(state)
// Update history to include the new state
const {location} = this.props
const {key, pathname, query, hash} = location
browserHistory.push({
key, pathname, query, hash, state,
})
}
loadData(year) {
if (this.state.years.indexOf(parseInt(year, 10)) === -1) {
hashHistory.push('/');
return;
}
/* eslint-disable */
const data = require(`../data/${year}.json`);
/* eslint-enable */
this.setState({
loading: false,
data: dataTransformer(data)
});
}