-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
18 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
(function() { | ||
var tinder = require('tinder'); | ||
var client = new tinder.TinderClient(); | ||
var remote = require('remote'); | ||
var remote = require('remote'); | ||
|
||
// if a token returned from tinder is in localstorage, set that token and skip auth | ||
if (localStorage.tinderToken) { client.setAuthToken(localStorage.tinderToken); } | ||
|
@@ -13,20 +13,20 @@ | |
var handleError = function(err, callbackFn) { | ||
console.log('ERROR!!!!'); | ||
console.log(err); | ||
|
||
// Tinder API token is not valid. | ||
if (err.status === 401 && localStorage.getItem('fbTokenExpiresAt') != null) { | ||
if(Date.parse(localStorage.fbTokenExpiresAt) > new Date()) { | ||
// Facebook token is still good. Get a new Tinder token. | ||
apiObj.login(localStorage.fbUserId, localStorage.fbToken); | ||
} else { | ||
// Facebook token expired. Get a new Facebook token. | ||
$location.path('/login'); | ||
} | ||
} else { | ||
// Something's gone horribly wrong. Log the user out. | ||
apiObj.logout(); | ||
} | ||
// | ||
// // Tinder API token is not valid. | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
hashier
|
||
// if (err.status === 401 && localStorage.getItem('fbTokenExpiresAt') != null) { | ||
// if(Date.parse(localStorage.fbTokenExpiresAt) > new Date()) { | ||
// // Facebook token is still good. Get a new Tinder token. | ||
// apiObj.login(localStorage.fbUserId, localStorage.fbToken); | ||
// } else { | ||
// // Facebook token expired. Get a new Facebook token. | ||
// $location.path('/login'); | ||
// } | ||
// } else { | ||
// // Something's gone horribly wrong. Log the user out. | ||
// apiObj.logout(); | ||
// } | ||
(callbackFn || angular.noop)(err); | ||
}; | ||
|
||
|
@@ -141,7 +141,7 @@ | |
apiObj.getAccount = function() { | ||
return $q(function (resolve, reject) { | ||
client.getAccount(function(err, res, data) { | ||
if (!!err) { | ||
if (!!err) { | ||
handleError(err, reject); | ||
return; | ||
} | ||
|
@@ -294,7 +294,7 @@ | |
}); | ||
}); | ||
}; | ||
|
||
apiObj.updatePassport = function(lat, lon){ | ||
return $q(function (resolve, reject) { | ||
client.updatePassport(lat, lon, function(err, res, data) { | ||
|
@@ -307,7 +307,7 @@ | |
}); | ||
}); | ||
} | ||
|
||
apiObj.resetPassport = function(){ | ||
return $q(function (resolve, reject) { | ||
client.resetPassport(function(err, res, data) { | ||
|
I ran into auth problems. So I enabled those lines again and it started working again