popup info ; token update
This commit is contained in:
@@ -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);
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user