Fix crash caused by typo
This commit is contained in:
@@ -46,7 +46,6 @@ class API extends EventEmitter {
|
|||||||
this._apiURL = null
|
this._apiURL = null
|
||||||
|
|
||||||
const checkForToken = () => {
|
const checkForToken = () => {
|
||||||
console.log(`${this._backend} - ${this.apiURL}`)
|
|
||||||
AsyncStorage.getItem(authTokenKeyName)
|
AsyncStorage.getItem(authTokenKeyName)
|
||||||
.then((token) => {
|
.then((token) => {
|
||||||
if (!token) {
|
if (!token) {
|
||||||
@@ -57,13 +56,11 @@ class API extends EventEmitter {
|
|||||||
return this.who()
|
return this.who()
|
||||||
})
|
})
|
||||||
.then((user) => {
|
.then((user) => {
|
||||||
console.log("token good")
|
|
||||||
this.user = user
|
this.user = user
|
||||||
this.connectSocket()
|
this.connectSocket()
|
||||||
this.emit("login")
|
this.emit("login")
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
console.log("token not present")
|
|
||||||
AsyncStorage.removeItem(authTokenKeyName)
|
AsyncStorage.removeItem(authTokenKeyName)
|
||||||
this.token = null
|
this.token = null
|
||||||
this.user = {}
|
this.user = {}
|
||||||
@@ -80,14 +77,12 @@ class API extends EventEmitter {
|
|||||||
if (!this.apiURL) {
|
if (!this.apiURL) {
|
||||||
return Promise.reject()
|
return Promise.reject()
|
||||||
}
|
}
|
||||||
console.log(`setting backend ${this._backend} - ${this.apiURL}`)
|
|
||||||
checkForToken()
|
checkForToken()
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
this._backend = "normal"
|
this._backend = "normal"
|
||||||
this.apiURL = baseURLS[this._backend]
|
this.apiURL = API.urls[this._backend]
|
||||||
AsyncStorage.setItem(backendKeyName, this._backend)
|
AsyncStorage.setItem(backendKeyName, this._backend)
|
||||||
console.log("setting default backend")
|
|
||||||
checkForToken()
|
checkForToken()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -175,7 +170,6 @@ class API extends EventEmitter {
|
|||||||
if (newBaseURL) {
|
if (newBaseURL) {
|
||||||
this.apiURL = newBaseURL
|
this.apiURL = newBaseURL
|
||||||
this._backend = backend
|
this._backend = backend
|
||||||
console.log(`setting backend ${this._backend} - ${this.apiURL}`)
|
|
||||||
AsyncStorage.setItem(backendKeyName, this._backend).then(
|
AsyncStorage.setItem(backendKeyName, this._backend).then(
|
||||||
this.logout,
|
this.logout,
|
||||||
this.logout
|
this.logout
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
export const localIPAddr = "192.168.1.175"
|
export const localIPAddr = "192.168.1.175"
|
||||||
export const defaultUser = "john@lyon-smith.org"
|
// export const defaultUser = "john@lyon-smith.org"
|
||||||
|
export const defaultUser = ""
|
||||||
|
|||||||
Reference in New Issue
Block a user