mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 09:23:13 +01:00
Replace usage of History mixin with contextTypes
This commit is contained in:
parent
d0586c937d
commit
5900e900ae
@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import { Link, History } from 'react-router';
|
||||
import { Link } from 'react-router';
|
||||
import Moment from 'moment';
|
||||
|
||||
import Row from 'react-bootstrap/lib/Row';
|
||||
@ -44,8 +44,6 @@ let Edition = React.createClass({
|
||||
loadEdition: React.PropTypes.func
|
||||
},
|
||||
|
||||
mixins: [History],
|
||||
|
||||
getDefaultProps() {
|
||||
return {
|
||||
furtherDetailsType: FurtherDetails
|
||||
|
@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import { History } from 'react-router';
|
||||
|
||||
import Row from 'react-bootstrap/lib/Row';
|
||||
import Col from 'react-bootstrap/lib/Col';
|
||||
@ -42,7 +41,9 @@ let EditionActionPanel = React.createClass({
|
||||
handleSuccess: React.PropTypes.func
|
||||
},
|
||||
|
||||
mixins: [History],
|
||||
contextTypes: {
|
||||
router: React.PropTypes.object.isRequired
|
||||
},
|
||||
|
||||
getDefaultProps() {
|
||||
return {
|
||||
@ -75,7 +76,7 @@ let EditionActionPanel = React.createClass({
|
||||
let notification = new GlobalNotificationModel(response.notification, 'success');
|
||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||
|
||||
this.history.pushState(null, '/collection');
|
||||
this.context.router.push({ pathname: '/collection' });
|
||||
},
|
||||
|
||||
refreshCollection() {
|
||||
|
@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import { History } from 'react-router';
|
||||
|
||||
import ReactError from '../../mixins/react_error';
|
||||
import { ResourceNotFoundError } from '../../models/errors';
|
||||
@ -31,7 +30,7 @@ let EditionContainer = React.createClass({
|
||||
params: React.PropTypes.object
|
||||
},
|
||||
|
||||
mixins: [History, ReactError],
|
||||
mixins: [ReactError],
|
||||
|
||||
getInitialState() {
|
||||
return mergeOptions(
|
||||
|
@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import { History } from 'react-router';
|
||||
import Moment from 'moment';
|
||||
|
||||
import ReactError from '../../mixins/react_error';
|
||||
@ -57,7 +56,11 @@ let PieceContainer = React.createClass({
|
||||
params: React.PropTypes.object
|
||||
},
|
||||
|
||||
mixins: [History, ReactError],
|
||||
contextTypes: {
|
||||
router: React.PropTypes.object.isRequired
|
||||
},
|
||||
|
||||
mixins: [ReactError],
|
||||
|
||||
getDefaultProps() {
|
||||
return {
|
||||
@ -159,7 +162,7 @@ let PieceContainer = React.createClass({
|
||||
let notification = new GlobalNotificationModel(response.notification, 'success');
|
||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||
|
||||
this.history.pushState(null, '/collection');
|
||||
this.context.router.push({ pathname: '/collection' });
|
||||
},
|
||||
|
||||
getCreateEditionsDialog() {
|
||||
|
@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import { History } from 'react-router';
|
||||
|
||||
import GlobalNotificationModel from '../../models/global_notification_model';
|
||||
import GlobalNotificationActions from '../../actions/global_notification_actions';
|
||||
@ -13,7 +12,6 @@ import Form from './form';
|
||||
import Property from './property';
|
||||
|
||||
import ApiUrls from '../../constants/api_urls';
|
||||
import AppConstants from '../../constants/application_constants';
|
||||
import AscribeSpinner from '../ascribe_spinner';
|
||||
|
||||
import { getLangText } from '../../utils/lang_utils';
|
||||
@ -28,8 +26,6 @@ let LoginForm = React.createClass({
|
||||
location: React.PropTypes.object
|
||||
},
|
||||
|
||||
mixins: [History],
|
||||
|
||||
getDefaultProps() {
|
||||
return {
|
||||
headerMessage: getLangText('Enter ascribe'),
|
||||
|
@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import { History } from 'react-router';
|
||||
|
||||
import ContractListActions from '../../actions/contract_list_actions';
|
||||
import ContractListStore from '../../stores/contract_list_store';
|
||||
@ -25,7 +24,9 @@ let SendContractAgreementForm = React.createClass({
|
||||
handleSuccess: React.PropTypes.func
|
||||
},
|
||||
|
||||
mixins: [History],
|
||||
contextTypes: {
|
||||
router: React.PropTypes.object
|
||||
},
|
||||
|
||||
getInitialState() {
|
||||
return mergeOptions(
|
||||
@ -58,7 +59,7 @@ let SendContractAgreementForm = React.createClass({
|
||||
notification = new GlobalNotificationModel(notification, 'success', 10000);
|
||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||
|
||||
this.history.pushState(null, '/collection');
|
||||
this.context.router.push({ pathname: '/collection' });
|
||||
},
|
||||
|
||||
getFormData() {
|
||||
|
@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import { History } from 'react-router';
|
||||
|
||||
import UserStore from '../../stores/user_store';
|
||||
import UserActions from '../../actions/user_actions';
|
||||
@ -28,8 +27,6 @@ let SignupForm = React.createClass({
|
||||
location: React.PropTypes.object
|
||||
},
|
||||
|
||||
mixins: [History],
|
||||
|
||||
getDefaultProps() {
|
||||
return {
|
||||
headerMessage: getLangText('Welcome to ascribe'),
|
||||
|
@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import { RouteContext } from 'react-router';
|
||||
import history from '../../history';
|
||||
|
||||
import UserStore from '../../stores/user_store';
|
||||
@ -40,7 +39,7 @@ export function AuthRedirect({to, when}) {
|
||||
|
||||
// and redirect if `true`.
|
||||
if(exprToValidate) {
|
||||
window.setTimeout(() => history.replaceState(null, to, query));
|
||||
window.setTimeout(() => history.replace({ path: to, query }));
|
||||
return true;
|
||||
|
||||
// Otherwise there can also be the case that the backend
|
||||
@ -48,7 +47,7 @@ export function AuthRedirect({to, when}) {
|
||||
} else if(!exprToValidate && when === 'loggedIn' && redirect) {
|
||||
|
||||
delete query.redirect;
|
||||
window.setTimeout(() => history.replaceState(null, '/' + redirect, query));
|
||||
window.setTimeout(() => history.replace({ path: '/' + redirect, query: query }));
|
||||
return true;
|
||||
|
||||
} else if(!exprToValidate && when === 'loggedOut' && redirectAuthenticated) {
|
||||
@ -81,17 +80,36 @@ export function ProxyHandler(...redirectFunctions) {
|
||||
displayName: 'ProxyHandler',
|
||||
|
||||
propTypes: {
|
||||
location: object
|
||||
location: object,
|
||||
|
||||
// Supplied by react-router
|
||||
route: object
|
||||
},
|
||||
|
||||
// We need insert `RouteContext` here in order to be able
|
||||
// to use the `Lifecycle` widget in further down nested components
|
||||
mixins: [RouteContext],
|
||||
contextTypes: {
|
||||
router: object
|
||||
},
|
||||
|
||||
childContextTypes: {
|
||||
route: object,
|
||||
router: object
|
||||
},
|
||||
|
||||
getInitialState() {
|
||||
return UserStore.getState();
|
||||
},
|
||||
|
||||
getChildContext() {
|
||||
return {
|
||||
route: this.props.route,
|
||||
|
||||
// TODO: Find out if it is necessary to
|
||||
// pass router here as a contextType, since
|
||||
// react-router apparently does it already
|
||||
router: this.context.router
|
||||
};
|
||||
},
|
||||
|
||||
componentDidMount() {
|
||||
UserStore.listen(this.onChange);
|
||||
UserActions.fetchCurrentUser();
|
||||
|
@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import { History, Lifecycle } from 'react-router';
|
||||
|
||||
import SlidesContainerBreadcrumbs from './slides_container_breadcrumbs';
|
||||
|
||||
@ -21,7 +20,10 @@ const SlidesContainer = React.createClass({
|
||||
pageExitWarning: string
|
||||
},
|
||||
|
||||
mixins: [History, Lifecycle],
|
||||
contextTypes: {
|
||||
route: object.isRequired,
|
||||
router: object.isRequired
|
||||
},
|
||||
|
||||
getInitialState() {
|
||||
return {
|
||||
@ -37,6 +39,11 @@ const SlidesContainer = React.createClass({
|
||||
|
||||
// Initially, we need to dispatch 'resize' once to render correctly
|
||||
window.dispatchEvent(new Event('resize'));
|
||||
|
||||
// Since react-router 2.0.0, we need to define the `routerWillLeave`
|
||||
// method ourselves.
|
||||
const { router, route } = this.context;
|
||||
router.setRouteLeaveHook(route, this.routerWillLeave);
|
||||
},
|
||||
|
||||
componentWillUnmount() {
|
||||
@ -64,7 +71,7 @@ const SlidesContainer = React.createClass({
|
||||
setSlideNum(nextSlideNum, additionalQueryParams = {}) {
|
||||
let queryParams = Object.assign(this.props.location.query, additionalQueryParams);
|
||||
queryParams.slide_num = nextSlideNum;
|
||||
this.history.pushState(null, this.props.location.pathname, queryParams);
|
||||
this.context.router.push({ pathname: this.props.location.pathname, query: queryParams });
|
||||
},
|
||||
|
||||
// breadcrumbs are defined as attributes of the slides.
|
||||
|
@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import { History } from 'react-router';
|
||||
|
||||
import AscribeSpinner from './ascribe_spinner';
|
||||
|
||||
@ -13,8 +12,6 @@ import { setDocumentTitle } from '../utils/dom_utils';
|
||||
|
||||
|
||||
let LogoutContainer = React.createClass({
|
||||
mixins: [History],
|
||||
|
||||
componentDidMount() {
|
||||
UserActions.logoutCurrentUser();
|
||||
alt.flush();
|
||||
|
@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import { History } from 'react-router';
|
||||
|
||||
import Form from './ascribe_forms/form';
|
||||
import Property from './ascribe_forms/property';
|
||||
@ -120,7 +119,9 @@ let PasswordResetForm = React.createClass({
|
||||
token: React.PropTypes.string
|
||||
},
|
||||
|
||||
mixins: [History],
|
||||
contextTypes: {
|
||||
router: React.PropTypes.object.isRequired
|
||||
},
|
||||
|
||||
getFormData() {
|
||||
return {
|
||||
@ -130,7 +131,7 @@ let PasswordResetForm = React.createClass({
|
||||
},
|
||||
|
||||
handleSuccess() {
|
||||
this.history.pushState(null, '/collection');
|
||||
this.context.router.push({ pathname: '/collection' });
|
||||
let notification = new GlobalNotificationModel(getLangText('password successfully updated'), 'success', 10000);
|
||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||
},
|
||||
|
@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import { History } from 'react-router';
|
||||
|
||||
import PieceListStore from '../stores/piece_list_store';
|
||||
import PieceListActions from '../actions/piece_list_actions';
|
||||
@ -46,7 +45,9 @@ let PieceList = React.createClass({
|
||||
location: React.PropTypes.object
|
||||
},
|
||||
|
||||
mixins: [History],
|
||||
contextTypes: {
|
||||
router: React.PropTypes.object.isRequired
|
||||
},
|
||||
|
||||
getDefaultProps() {
|
||||
return {
|
||||
@ -115,13 +116,17 @@ let PieceList = React.createClass({
|
||||
},
|
||||
|
||||
componentDidUpdate() {
|
||||
const { redirectTo, shouldRedirect } = this.props;
|
||||
const { redirectTo: pathname,
|
||||
shouldRedirect,
|
||||
location: {
|
||||
query
|
||||
} } = this.props;
|
||||
const { unfilteredPieceListCount } = this.state;
|
||||
|
||||
if (redirectTo && unfilteredPieceListCount === 0 &&
|
||||
if (pathname && unfilteredPieceListCount === 0 &&
|
||||
(typeof shouldRedirect === 'function' && shouldRedirect(unfilteredPieceListCount))) {
|
||||
// FIXME: hack to redirect out of the dispatch cycle
|
||||
window.setTimeout(() => this.history.pushState(null, this.props.redirectTo, this.props.location.query), 0);
|
||||
window.setTimeout(() => this.context.router.push({ pathname, query }), 0);
|
||||
}
|
||||
},
|
||||
|
||||
@ -175,14 +180,19 @@ let PieceList = React.createClass({
|
||||
},
|
||||
|
||||
searchFor(searchTerm) {
|
||||
const { pathname } = this.props.location;
|
||||
|
||||
this.loadPieceList({
|
||||
page: 1,
|
||||
search: searchTerm
|
||||
});
|
||||
this.history.pushState(null, this.props.location.pathname, {page: 1});
|
||||
|
||||
this.context.router.push({ pathname, query: {page: 1} });
|
||||
},
|
||||
|
||||
applyFilterBy(filterBy){
|
||||
applyFilterBy(filterBy) {
|
||||
const { pathname } = this.props.location;
|
||||
|
||||
this.setState({
|
||||
isFilterDirty: true
|
||||
});
|
||||
@ -207,7 +217,7 @@ let PieceList = React.createClass({
|
||||
|
||||
// we have to redirect the user always to page one as it could be that there is no page two
|
||||
// for filtered pieces
|
||||
this.history.pushState(null, this.props.location.pathname, {page: 1});
|
||||
this.context.router.push({ pathname, query: {page: 1} });
|
||||
},
|
||||
|
||||
applyOrderBy(orderBy) {
|
||||
|
@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import { History } from 'react-router';
|
||||
|
||||
import Col from 'react-bootstrap/lib/Col';
|
||||
import Row from 'react-bootstrap/lib/Row';
|
||||
@ -38,7 +37,9 @@ let RegisterPiece = React.createClass( {
|
||||
location: React.PropTypes.object
|
||||
},
|
||||
|
||||
mixins: [History],
|
||||
contextTypes: {
|
||||
router: React.PropTypes.object.isRequired
|
||||
},
|
||||
|
||||
getInitialState(){
|
||||
return mergeOptions(
|
||||
@ -80,7 +81,7 @@ let RegisterPiece = React.createClass( {
|
||||
this.state.filterBy
|
||||
);
|
||||
|
||||
this.history.pushState(null, `/pieces/${response.piece.id}`);
|
||||
this.context.router.push({ pathname: `/pieces/${response.piece.id}` });
|
||||
},
|
||||
|
||||
getSpecifyEditions() {
|
||||
|
@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import { History } from 'react-router';
|
||||
|
||||
import Form from '../../../../../ascribe_forms/form';
|
||||
import Property from '../../../../../ascribe_forms/property';
|
||||
@ -35,7 +34,9 @@ const PRRegisterPieceForm = React.createClass({
|
||||
currentUser: object
|
||||
},
|
||||
|
||||
mixins: [History],
|
||||
contextTypes: {
|
||||
router: object
|
||||
},
|
||||
|
||||
getInitialState() {
|
||||
return {
|
||||
@ -106,7 +107,7 @@ const PRRegisterPieceForm = React.createClass({
|
||||
GlobalNotificationActions.appendGlobalNotification(notificationMessage);
|
||||
});
|
||||
})
|
||||
.then(() => this.history.pushState(null, `/pieces/${this.state.piece.id}`))
|
||||
.then(() => this.context.router.push({ pathname: `/pieces/${this.state.piece.id}` }))
|
||||
.catch((err) => {
|
||||
const errMessage = (getErrorNotificationMessage(err) || getLangText("Oops! We weren't able to send your submission.")) +
|
||||
getLangText(' Please contact support@ascribe.io');
|
||||
|
@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import { History } from 'react-router';
|
||||
|
||||
import PrizeActions from '../../simple_prize/actions/prize_actions';
|
||||
import PrizeStore from '../../simple_prize/stores/prize_store';
|
||||
@ -23,7 +22,9 @@ const PRLanding = React.createClass({
|
||||
location: React.PropTypes.object
|
||||
},
|
||||
|
||||
mixins: [History],
|
||||
contextTypes: {
|
||||
router: React.PropTypes.object
|
||||
},
|
||||
|
||||
getInitialState() {
|
||||
return mergeOptions(
|
||||
@ -42,7 +43,12 @@ const PRLanding = React.createClass({
|
||||
if(location && location.query && location.query.redirect) {
|
||||
let queryCopy = JSON.parse(JSON.stringify(location.query));
|
||||
delete queryCopy.redirect;
|
||||
window.setTimeout(() => this.history.replaceState(null, `/${location.query.redirect}`, queryCopy));
|
||||
window.setTimeout(() => {
|
||||
this.context.router.replace({
|
||||
pathname: `/${location.query.redirect}`,
|
||||
query: queryCopy
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import { Link, History } from 'react-router';
|
||||
import { Link } from 'react-router';
|
||||
|
||||
import Col from 'react-bootstrap/lib/Col';
|
||||
import Row from 'react-bootstrap/lib/Row';
|
||||
@ -23,7 +23,9 @@ const PRRegisterPiece = React.createClass({
|
||||
location: object
|
||||
},
|
||||
|
||||
mixins: [History],
|
||||
contextTypes: {
|
||||
router: object
|
||||
},
|
||||
|
||||
getInitialState() {
|
||||
return UserStore.getState();
|
||||
@ -39,7 +41,7 @@ const PRRegisterPiece = React.createClass({
|
||||
if(currentUser && currentUser.email) {
|
||||
const submittedPieceId = getCookie(currentUser.email);
|
||||
if(submittedPieceId) {
|
||||
this.history.pushState(null, `/pieces/${submittedPieceId}`);
|
||||
this.context.router.push({ pathname: `/pieces/${submittedPieceId}` });
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -17,7 +17,7 @@ export function AuthPrizeRoleRedirect({ to, when }) {
|
||||
.reduce((a, b) => a || b);
|
||||
|
||||
if (exprToValidate) {
|
||||
window.setTimeout(() => history.replaceState(null, to, query));
|
||||
window.setTimeout(() => history.replace({ path: to, query: query }));
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import { History } from 'react-router';
|
||||
|
||||
import PrizeActions from '../actions/prize_actions';
|
||||
import PrizeStore from '../stores/prize_store';
|
||||
@ -19,7 +18,9 @@ import { getLangText } from '../../../../../utils/lang_utils';
|
||||
|
||||
let Landing = React.createClass({
|
||||
|
||||
mixins: [History],
|
||||
contextTypes: {
|
||||
router: React.PropTypes.object.isRequired
|
||||
},
|
||||
|
||||
getInitialState() {
|
||||
return mergeOptions(
|
||||
@ -46,7 +47,7 @@ let Landing = React.createClass({
|
||||
// if user is already logged in, redirect him to piece list
|
||||
if(this.state.currentUser && this.state.currentUser.email) {
|
||||
// FIXME: hack to redirect out of the dispatch cycle
|
||||
window.setTimeout(() => this.history.replaceState(null, '/collection'), 0);
|
||||
window.setTimeout(() => this.context.router.replace({ pathname: '/collection' }), 0);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import { History } from 'react-router';
|
||||
|
||||
import PieceActions from '../../../../../../actions/piece_actions';
|
||||
import PieceStore from '../../../../../../stores/piece_store';
|
||||
@ -36,7 +35,9 @@ let CylandPieceContainer = React.createClass({
|
||||
params: React.PropTypes.object
|
||||
},
|
||||
|
||||
mixins: [History],
|
||||
contextTypes: {
|
||||
router: React.PropTypes.object
|
||||
},
|
||||
|
||||
getInitialState() {
|
||||
return mergeOptions(
|
||||
@ -85,7 +86,7 @@ let CylandPieceContainer = React.createClass({
|
||||
let notification = new GlobalNotificationModel(response.notification, 'success');
|
||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||
|
||||
this.history.pushState(null, '/collection');
|
||||
this.context.router.push({ pathname: '/collection' });
|
||||
},
|
||||
|
||||
render() {
|
||||
|
@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import { History } from 'react-router';
|
||||
|
||||
import WhitelabelActions from '../../../../../actions/whitelabel_actions';
|
||||
import WhitelabelStore from '../../../../../stores/whitelabel_store';
|
||||
@ -13,8 +12,6 @@ import LinkContainer from 'react-router-bootstrap/lib/LinkContainer';
|
||||
import UserStore from '../../../../../stores/user_store';
|
||||
import UserActions from '../../../../../actions/user_actions';
|
||||
|
||||
import AscribeSpinner from '../../../../ascribe_spinner';
|
||||
|
||||
import { mergeOptions } from '../../../../../utils/general_utils';
|
||||
import { getLangText } from '../../../../../utils/lang_utils';
|
||||
import { setDocumentTitle } from '../../../../../utils/dom_utils';
|
||||
@ -22,7 +19,9 @@ import { setDocumentTitle } from '../../../../../utils/dom_utils';
|
||||
|
||||
let CylandLanding = React.createClass({
|
||||
|
||||
mixins: [History],
|
||||
contextTypes: {
|
||||
router: React.PropTypes.object.isRequired
|
||||
},
|
||||
|
||||
getInitialState() {
|
||||
return mergeOptions(
|
||||
@ -49,7 +48,7 @@ let CylandLanding = React.createClass({
|
||||
// if user is already logged in, redirect him to piece list
|
||||
if(this.state.currentUser && this.state.currentUser.email) {
|
||||
// FIXME: hack to redirect out of the dispatch cycle
|
||||
window.setTimeout(() => this.history.replaceState(null, '/collection'), 0);
|
||||
window.setTimeout(() => this.context.router.replace({ pathname: '/collection' }), 0);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import { History } from 'react-router';
|
||||
|
||||
import Moment from 'moment';
|
||||
|
||||
@ -46,7 +45,9 @@ let CylandRegisterPiece = React.createClass({
|
||||
location: React.PropTypes.object
|
||||
},
|
||||
|
||||
mixins: [History],
|
||||
contextTypes: {
|
||||
router: React.PropTypes.object.isRequired
|
||||
},
|
||||
|
||||
getInitialState(){
|
||||
return mergeOptions(
|
||||
@ -129,7 +130,7 @@ let CylandRegisterPiece = React.createClass({
|
||||
|
||||
PieceActions.fetchOne(this.state.piece.id);
|
||||
|
||||
this.history.pushState(null, `/pieces/${this.state.piece.id}`);
|
||||
this.context.router.push({ pathname: `/pieces/${this.state.piece.id}` });
|
||||
},
|
||||
|
||||
// We need to increase the step to lock the forms that are already filled out
|
||||
|
@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import { History } from 'react-router';
|
||||
|
||||
import Glyphicon from 'react-bootstrap/lib/Glyphicon';
|
||||
import Button from 'react-bootstrap/lib/Button';
|
||||
@ -33,7 +32,9 @@ import { mergeOptions } from '../../../../../utils/general_utils';
|
||||
|
||||
let IkonotvContractNotifications = React.createClass({
|
||||
|
||||
mixins: [History],
|
||||
contextTypes: {
|
||||
router: React.PropTypes.object.isRequired
|
||||
},
|
||||
|
||||
getInitialState() {
|
||||
return mergeOptions(
|
||||
@ -119,7 +120,7 @@ let IkonotvContractNotifications = React.createClass({
|
||||
NotificationActions.flushContractAgreementListNotifications();
|
||||
NotificationActions.fetchContractAgreementListNotifications();
|
||||
|
||||
this.history.pushState(null, '/collection');
|
||||
this.context.router.push({ pathname: '/collection' });
|
||||
},
|
||||
|
||||
handleDeny() {
|
||||
@ -132,7 +133,7 @@ let IkonotvContractNotifications = React.createClass({
|
||||
handleDenySuccess() {
|
||||
let notification = new GlobalNotificationModel(getLangText('You have denied the conditions'), 'success', 5000);
|
||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||
this.history.pushState(null, '/collection');
|
||||
this.context.router.push({ pathname: '/collection' });
|
||||
},
|
||||
|
||||
getCopyrightAssociationForm(){
|
||||
|
@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import { History } from 'react-router';
|
||||
|
||||
import PieceActions from '../../../../../../actions/piece_actions';
|
||||
import PieceStore from '../../../../../../stores/piece_store';
|
||||
@ -37,7 +36,9 @@ let IkonotvPieceContainer = React.createClass({
|
||||
params: React.PropTypes.object
|
||||
},
|
||||
|
||||
mixins: [History],
|
||||
contextTypes: {
|
||||
router: React.PropTypes.object.isRequired
|
||||
},
|
||||
|
||||
getInitialState() {
|
||||
return mergeOptions(
|
||||
@ -94,7 +95,7 @@ let IkonotvPieceContainer = React.createClass({
|
||||
let notification = new GlobalNotificationModel(response.notification, 'success');
|
||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||
|
||||
this.history.pushState(null, '/collection');
|
||||
this.context.router.push({ pathname: '/collection' });
|
||||
},
|
||||
|
||||
render() {
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
import React from 'react';
|
||||
import Moment from 'moment';
|
||||
import { History } from 'react-router';
|
||||
|
||||
import Col from 'react-bootstrap/lib/Col';
|
||||
import Row from 'react-bootstrap/lib/Row';
|
||||
@ -43,7 +42,9 @@ let IkonotvRegisterPiece = React.createClass({
|
||||
location: React.PropTypes.object
|
||||
},
|
||||
|
||||
mixins: [History],
|
||||
contextTypes: {
|
||||
router: React.PropTypes.object.isRequired
|
||||
},
|
||||
|
||||
getInitialState(){
|
||||
return mergeOptions(
|
||||
@ -103,7 +104,7 @@ let IkonotvRegisterPiece = React.createClass({
|
||||
PieceActions.updatePiece(response.piece);
|
||||
}
|
||||
if (!this.canSubmit()) {
|
||||
this.history.pushState(null, '/collection');
|
||||
this.context.router.push({ pathname: '/collection' });
|
||||
}
|
||||
else {
|
||||
this.incrementStep();
|
||||
@ -134,7 +135,7 @@ let IkonotvRegisterPiece = React.createClass({
|
||||
this.refreshPieceList();
|
||||
|
||||
PieceActions.fetchOne(this.state.piece.id);
|
||||
this.history.pushState(null, `/pieces/${this.state.piece.id}`);
|
||||
this.context.router.push({ pathname: `/pieces/${this.state.piece.id}` });
|
||||
},
|
||||
|
||||
// We need to increase the step to lock the forms that are already filled out
|
||||
|
@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import { History } from 'react-router';
|
||||
|
||||
import Col from 'react-bootstrap/lib/Col';
|
||||
import Row from 'react-bootstrap/lib/Row';
|
||||
@ -30,7 +29,9 @@ let MarketRegisterPiece = React.createClass({
|
||||
location: React.PropTypes.object
|
||||
},
|
||||
|
||||
mixins: [History],
|
||||
contextTypes: {
|
||||
router: React.PropTypes.object.isRequired
|
||||
},
|
||||
|
||||
getInitialState(){
|
||||
return mergeOptions(
|
||||
@ -82,7 +83,7 @@ let MarketRegisterPiece = React.createClass({
|
||||
handleAdditionalDataSuccess() {
|
||||
this.refreshPieceList();
|
||||
|
||||
this.history.pushState(null, '/collection');
|
||||
this.context.router.push({ pathname: '/collection' });
|
||||
},
|
||||
|
||||
// We need to increase the step to lock the forms that are already filled out
|
||||
|
2
js/third_party/notifications.js
vendored
2
js/third_party/notifications.js
vendored
@ -29,7 +29,7 @@ class NotificationsHandler {
|
||||
if (res.notifications && res.notifications.length > 0) {
|
||||
this.loaded = true;
|
||||
console.log('Contractagreement notifications loaded');
|
||||
history.pushState(null, '/contract_notifications');
|
||||
history.push({ pathname: '/contract_notifications' });
|
||||
}
|
||||
}
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user