Fix non awaited promises (#88)

This commit is contained in:
Niklas Fondberg
2021-11-18 14:38:13 +01:00
committed by GitHub
parent a979d30314
commit e60adb04a9
2 changed files with 10 additions and 3 deletions
+6 -3
View File
@@ -407,22 +407,25 @@ export class ProductAPI extends BaseSQLDataSource {
productId: number,
info: ProductInfoInput,
): Promise<any[]> {
const promises = [];
// Check path and insert new unique path if taken
const uniquePath = await this.getUniqueProductPath(info.path, productId);
const oldProd = await this.getProduct(productId);
if (oldProd.path !== uniquePath) {
sendPathChangedCmd(oldProd.path, uniquePath);
const promise = sendPathChangedCmd(oldProd.path, uniquePath);
promises.push(promise);
}
if (oldProd.fields.name !== info.name) {
await this.textsApi.translateProductName(
const promise = this.textsApi.translateProductName(
info.name,
oldProd.path,
uniquePath,
);
promises.push(promise);
}
const promises = [];
promises.push(
this.knex
.table('product-products')