fix multiple config lines
This commit is contained in:
parent
e10ee70d4a
commit
559bb6e12c
|
@ -149,9 +149,14 @@ if (process.env.FORCE_SYNC == true) {
|
|||
}
|
||||
|
||||
if (process.env.SECRETS) {
|
||||
await models.clientConfig.create({
|
||||
await models.clientConfig.findOrCreate({
|
||||
where: {
|
||||
id: 1,
|
||||
},
|
||||
defaults: {
|
||||
clientId: process.env.CLIENT_ID,
|
||||
clientSecret: process.env.CLIENT_SECRET,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -6,4 +6,6 @@ let floraholland = [
|
|||
8718288004970,
|
||||
];
|
||||
|
||||
let others = [];
|
||||
|
||||
export default {floraholland};
|
20
utils.js
20
utils.js
|
@ -81,20 +81,18 @@ async function getClientToken() {
|
|||
async function updateClientConfig(clientId, clientSecret, accessToken, tokenExpirationDate) {
|
||||
try {
|
||||
console.log('Updating the client config with the new token...');
|
||||
await models.clientConfig.update(
|
||||
{
|
||||
await models.clientConfig.findOrCreate({
|
||||
where: {
|
||||
id: 1,
|
||||
},
|
||||
defaults: {
|
||||
clientId: clientId,
|
||||
clientSecret: clientSecret,
|
||||
currentToken: accessToken,
|
||||
tokenExpiration: tokenExpirationDate,
|
||||
requestLimit : 500
|
||||
requestLimit: 500,
|
||||
},
|
||||
{
|
||||
where: {
|
||||
id: 1,
|
||||
},
|
||||
}
|
||||
);
|
||||
});
|
||||
console.log('Client config updated, new Token set');
|
||||
console.log('New token expiration date: ', tokenExpirationDate);
|
||||
} catch (error) {
|
||||
|
@ -397,9 +395,9 @@ async function syncTradeItems(){
|
|||
headers: headers
|
||||
});
|
||||
|
||||
let data = await request.json();
|
||||
let itemdata = await request.json();
|
||||
|
||||
let results = data.results;
|
||||
let results = itemdata.results;
|
||||
|
||||
if (results.length == 0) {
|
||||
console.log('No more trade items to sync');
|
||||
|
|
Loading…
Reference in New Issue