Skip to content

Commit

Permalink
Cleanup code
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDeBoey committed May 15, 2019
1 parent 9e4c326 commit 1c101e7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
6 changes: 2 additions & 4 deletions .eslintrc.js
Expand Up @@ -3,12 +3,10 @@ module.exports = {
browser: true,
es6: true,
},
extends: [
'eslint:recommended',
],
extends: ['eslint:recommended'],
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
ecmaVersion: 2018
},
rules: {
indent: ['error', 2],
Expand Down
11 changes: 6 additions & 5 deletions src/inertia.js
Expand Up @@ -53,16 +53,16 @@ export default {
this.cancelToken = axios.CancelToken.source()

return axios({
method: method,
url: url,
method,
url,
data: method.toLowerCase() === 'get' ? {} : data,
params: method.toLowerCase() === 'get' ? data : {},
cancelToken: this.cancelToken.token,
headers: {
'Accept': 'text/html, application/xhtml+xml',
Accept: 'text/html, application/xhtml+xml',
'X-Requested-With': 'XMLHttpRequest',
'X-Inertia': true,
...this.version ? { 'X-Inertia-Version': this.version } : {},
...(this.version ? { 'X-Inertia-Version': this.version } : {}),
},
}).then(response => {
if (this.isInertiaResponse(response)) {
Expand All @@ -86,6 +86,7 @@ export default {
if (page) {
this.version = page.version
this.setState(page, replace)

return this.setPage(page).then(() => {
this.setScroll(preserveScroll)
this.hideProgressBar()
Expand Down Expand Up @@ -151,7 +152,7 @@ export default {
remember(data, key = 'default') {
this.setState({
...window.history.state,
cache: { ...window.history.state.cache, [key]: data }
cache: { ...window.history.state.cache, [key]: data },
})
},

Expand Down

0 comments on commit 1c101e7

Please sign in to comment.