Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// TODO: return a parsed version of queryString
return {};
},
stringifyQuery: function(query) {
// TODO: return a query string created from query
return "";
}
})
history.createPath({ pathname: '/the/path', query: { the: 'query' } })
history.push({ pathname: '/the/path', query: { the: 'query' } })
}
{
// Run our app under the /base URL.
let history = useBasename(createHistory)({
basename: '/base'
})
// At the /base/hello/world URL:
history.listen(function(location) {
console.log(location.pathname) // /hello/world
console.log(location.basename) // /base
})
history.createPath('/the/path') // /base/the/path
history.push('/the/path') // push /base/the/path
}
import PrivateKeyActions from "actions/PrivateKeyActions";
import AccountRefsStore from "stores/AccountRefsStore";
import ChainTypes from "./components/Utility/ChainTypes";
import NotificationStore from "stores/NotificationStore";
import AltContainer from "alt/AltContainer";
import injectTapEventPlugin from 'react-tap-event-plugin';
import If from './components/If';
import TransactionConfirm from './components/TransactionConfirm';
import IdleTimer from 'react-idle-timer';
import { createHashHistory, useBasename } from 'history';
const history = useBasename(createHashHistory)({});
//Needed for React Developer Tools
window.React = React;
injectTapEventPlugin();
/*
const history = useBasename(createHistory)({
basename: '/index.html'
})
*/
require("./components/Utility/Prototypes"); // Adds a .equals method to Array for use in shouldComponentUpdate
require("dl_cli_index").init(window) // Adds some object refs to the global window object
// Main app component
class App extends React.Component {
route.getComponent = function(location, callback) {
requirePage(`./${r.modulePath}`)(pageElement => {
// HACK: ReactRouter requires a component, so we inject
// the pageElement into the route
route.page = pageElement.default;
callback(null, App);
});
};
}
return route;
});
let history = createHistory();
let versionPattern = /^\/(\d+|\d+\.\d+\.\d)\//;
let versionMatch = versionPattern.exec(window.location.pathname);
if (versionMatch) {
history = useBasename(createHistory)({
basename: `/${versionMatch[1]}`
});
}
setHistory(history);
// Return the router using HTML5 pushState
return React.createElement(Router, {
history: history,
onUpdate: function () {
logCurrentPageVisit();
shared.store = shared.store.set('route', sitemap.getRouteByPath(
this.state.location.pathname
));
// Restore the preferences hash after a page change
Prefs.sync(false);
}
}, ...routes);
import alt from "alt-instance"
import TradeBeforeSendActions from "actions/TradeBeforeSendActions"
import WalletDb from "stores/WalletDb"
import SettingsStore from "stores/SettingsStore"
import { createHashHistory, useBasename } from 'history';
const history = useBasename(createHashHistory)({});
class TradeBeforeSendStore {
constructor() {
this.bindActions(TradeBeforeSendActions)
this.state = {locked: true, unclosable:false}
console.log('store constructor tbs setState', WalletDb.isLocked())
}
onUnlock({resolve, reject}) {
console.log('store onUnlock tbs setState', WalletDb.isLocked());
//this.setState({open:true});
if( ! WalletDb.isLocked()) {
// if(true) { // TODO for test
resolve()
return
createHistory: basename ? (() => useBasename(createHistory)({basename})) : createHistory
}),
const createHistoryWithBasename = (opts = {}) => {
return useBasename(createHistory)({
...opts,
basename: `/${BASE_PATH}`
});
};
export default function withBasename (history, dirname) {
return useBasename(() => history)({ basename: `/${dirname}` })
}
import React, { Component } from 'react'
import Layout from './Layout'
import Home from './pages/Home'
import { Router } from 'react-router'
import { createHistory, useBasename } from 'history'
import routes from './routes'
const browserHistory = useBasename(createHistory)({
basename: '/draft-js-editor'
})
const rootRoute = {
childRoutes: [ {
path: '/',
component: Layout,
indexRoute: {
component: Home,
},
childRoutes: routes,
} ]
}
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { Router, Route, IndexRoute } from 'react-router';
import { createHistory, useBasename } from 'history';
import store from './store';
import Example from './example';
const history = useBasename(createHistory)({
basename: window.location.pathname,
});
const app = document.getElementById('root');
ReactDOM.render(
,
app,
);