fix prompt logic

This commit is contained in:
Travis Eden 2018-11-07 10:06:03 -05:00
parent 936ac2f439
commit d35f48a90e

View file

@ -8,7 +8,7 @@ import { SAVE } from '../../constants/confirmation_messages';
class PublishTool extends React.Component {
render () {
const {disabled, file, isUpdate, hasChanged, uri, status} = this.props;
const {disabled, file, isUpdate, hasChanged, uri, status, location: currentLocation} = this.props;
if (disabled) {
return (
<PublishDisabledMessage />
@ -24,7 +24,7 @@ class PublishTool extends React.Component {
<React.Fragment>
<Prompt
when={hasChanged}
message={(location) => location.pathname === '/' ? true : SAVE}
message={(location) => location.pathname === currentLocation.pathname ? false : SAVE}
/>
<PublishPreview isUpdate={isUpdate} uri={uri} />
</React.Fragment>