fix pathname issues when using next export

main
Mike Fix 6 years ago
parent 20f9b5aa82
commit b665dfc5f4

@ -71,8 +71,8 @@ class Editor extends React.Component {
async componentDidMount() { async componentDidMount() {
const { asPath = '' } = this.props const { asPath = '' } = this.props
const { query } = url.parse(asPath, true) const { query, pathname } = url.parse(asPath, true)
const path = removeQueryString(asPath.split('/').pop()) const path = escapeHtml(pathname.split('/').pop())
const queryParams = getQueryStringState(query) const queryParams = getQueryStringState(query)
const initialState = Object.keys(queryParams).length ? queryParams : {} const initialState = Object.keys(queryParams).length ? queryParams : {}
try { try {
@ -344,11 +344,6 @@ class Editor extends React.Component {
} }
} }
function removeQueryString(str) {
const qI = str.indexOf('?')
return escapeHtml(qI >= 0 ? str.substr(0, qI) : str)
}
function formatTimestamp() { function formatTimestamp() {
const timezoneOffset = new Date().getTimezoneOffset() * 60000 const timezoneOffset = new Date().getTimezoneOffset() * 60000
const timeString = new Date(Date.now() - timezoneOffset) const timeString = new Date(Date.now() - timezoneOffset)

Loading…
Cancel
Save