Merge branch 'master' into refactor-syncsuppliers

This commit is contained in:
Pau 2023-02-07 09:48:04 +01:00
commit 1cb0d06282
1 changed files with 7 additions and 11 deletions

View File

@ -81,17 +81,13 @@ async function getClientToken() {
async function updateClientConfig(clientId, clientSecret, accessToken, tokenExpirationDate) {
try {
console.log('Updating the client config with the new token...');
await models.clientConfig.findOrCreate({
where: {
await models.clientConfig.upsert({
id: 1,
},
defaults: {
clientId: clientId,
clientSecret: clientSecret,
currentToken: accessToken,
tokenExpiration: tokenExpirationDate,
requestLimit: 500,
},
});
console.log('Client config updated, new Token set');
console.log('New token expiration date: ', tokenExpirationDate);