Fix crash caused by typo

This commit is contained in:
John Lyon-Smith
2018-04-14 06:02:10 -07:00
parent cac8a3868e
commit f7d10ab41b
2 changed files with 3 additions and 8 deletions

View File

@@ -46,7 +46,6 @@ class API extends EventEmitter {
this._apiURL = null
const checkForToken = () => {
console.log(`${this._backend} - ${this.apiURL}`)
AsyncStorage.getItem(authTokenKeyName)
.then((token) => {
if (!token) {
@@ -57,13 +56,11 @@ class API extends EventEmitter {
return this.who()
})
.then((user) => {
console.log("token good")
this.user = user
this.connectSocket()
this.emit("login")
})
.catch(() => {
console.log("token not present")
AsyncStorage.removeItem(authTokenKeyName)
this.token = null
this.user = {}
@@ -80,14 +77,12 @@ class API extends EventEmitter {
if (!this.apiURL) {
return Promise.reject()
}
console.log(`setting backend ${this._backend} - ${this.apiURL}`)
checkForToken()
})
.catch(() => {
this._backend = "normal"
this.apiURL = baseURLS[this._backend]
this.apiURL = API.urls[this._backend]
AsyncStorage.setItem(backendKeyName, this._backend)
console.log("setting default backend")
checkForToken()
})
}
@@ -175,7 +170,6 @@ class API extends EventEmitter {
if (newBaseURL) {
this.apiURL = newBaseURL
this._backend = backend
console.log(`setting backend ${this._backend} - ${this.apiURL}`)
AsyncStorage.setItem(backendKeyName, this._backend).then(
this.logout,
this.logout

View File

@@ -1,2 +1,3 @@
export const localIPAddr = "192.168.1.175"
export const defaultUser = "john@lyon-smith.org"
// export const defaultUser = "john@lyon-smith.org"
export const defaultUser = ""