Skip to content

Commit e380927

Browse files
hotfix
1 parent 6d9f3ef commit e380927

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/mixins/wp-mixin.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import safeGet from 'safe-get'
33
import 'whatwg-fetch'
44

55
// wpGet just wraps some of the basic fetch boilerplate
6-
const wpGet = function ({ url, mapper, fetchOptions,errorCallback }) {
6+
const wpGet = function ({ url, mapper, fetchOptions, errorCallback }) {
77
return fetch(url, fetchOptions)
88
.then(res => {
99
if (!res.ok) {
@@ -28,7 +28,7 @@ export default {
2828
* @param {object} fetchOptions - An object that contains options for the fetch call. See https://github.github.io/fetch/ for more
2929
* informaiton. NOTE: Must set {credentials: 'include' | 'same-site'} for endpoints requiring cookie authentication.
3030
*/
31-
createWpLoader(url, options, fetchOptions,errorCallback) {
31+
createWpLoader(url, options, fetchOptions, errorCallback) {
3232
let mapper = options.mapper ? options.mapper : this.mapPosts
3333
url += options.embed !== false ? '?_embed&' : '?'
3434
if (safeGet(options, 'queryParams.length') > 0) {
@@ -42,12 +42,14 @@ export default {
4242
const pageToLoad = loader.pagesLoaded + 1
4343
const newPage = { loaded: false, content: [] }
4444
loader.pages.push(newPage)
45-
wpGet({ url: url + 'page=' + pageToLoad, mapper, fetchOptions,errorCallback }).then(content => {
45+
wpGet({ url: url + 'page=' + pageToLoad, mapper, fetchOptions, errorCallback }).then(content => {
4646
newPage.content = content
4747
newPage.loaded = true
4848
loader.pagesLoaded++
4949
})
50-
.catch(reason=>{errorCallback(reason)})
50+
.catch(reason => {
51+
errorCallback(reason)
52+
})
5153
},
5254
pagesLeft: true // This should be updated based on the X-WP-TotalPages header and pagesLoaded
5355
}

0 commit comments

Comments
 (0)