popup info ; token update

This commit is contained in:
GotPPay
2018-01-05 17:56:24 +01:00
parent b55dd56859
commit 03c346f5d2
4 changed files with 35 additions and 10 deletions

View File

@@ -10,12 +10,18 @@ module.exports = {
loadTokens : function(){
db.collection('token_list').findOne().then(tokens=>{
config.TOKEN = tokens.access_token;
config.REFRESH_TOKEN = tokens.refresh_token;
config.TOKEN_EXPIRES_IN = tokens.expires_in;
console.log("Tokens loaded");
if (tokens !== null){
config.TOKEN = tokens.access_token;
config.REFRESH_TOKEN = tokens.refresh_token;
config.TOKEN_EXPIRES_IN = tokens.expires_in;
}else{
//Cannot continue without tokens
console.log("Cannot continue without tokens in database");
process.exit(-1);
}
}).catch(e=>{
console.log("Error loading tokens");
console.log("Error loading tokens ! Cannot continue without tokens in database");
process.exit(-1);
})
}
}