Skip to content

Commit

Permalink
Fix issue with code vs status_code
Browse files Browse the repository at this point in the history
  • Loading branch information
mrz1836 committed Sep 20, 2020
1 parent a3d0595 commit fa9cb53
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const internalHeaderKey = 'x-user-session-token'
const visitorSessionKey = 'tncpw_session'

// Current version for requests from the API
const pkgVersion = 'v0.1.76'
const pkgVersion = 'v0.1.77'
const apiVersion = 'v1'

// getOptions is a factory for axios default options
Expand All @@ -45,6 +45,7 @@ function getOptions (t, useCustomSessionToken = '') {
}

// blockBrowser will block request from firing if loaded in web browser
// todo: change this to detect node instead of browser: https://github.com/flexdinesh/browser-or-node/blob/master/src/index.js
function blockBrowser () {
if (typeof window !== 'undefined') { throw Error('cannot do this request in a web browser') }
}
Expand Down Expand Up @@ -1286,7 +1287,7 @@ module.exports = {
response.data['exists'] = true
resolve(response.data)
} catch (e) {
if (typeof e.response !== 'undefined' && e.response.data.code === 404) {
if (typeof e.response !== 'undefined' && e.response.data.status_code === 404) {
resolve({ exists: false })
return
}
Expand Down

0 comments on commit fa9cb53

Please sign in to comment.