Skip to content

Commit

Permalink
fix: remove unused variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Labham-Jain committed Nov 1, 2023
1 parent 96c037c commit 47fca3f
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/services/product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ class ProductService extends BaseProductService {
return new Promise<Partial<Product & { rowNumber: number }>>(async (resolve, reject) => {
if (product.id) {
let productExists;
let isUpdating;
try {
await this.retrieve(product.id)
productExists = true
Expand All @@ -80,19 +79,17 @@ class ProductService extends BaseProductService {
}
try {
if (productExists) {
isUpdating = true
const { id, rowNumber, ...updateProduct } = product as UpdateProductInput & { id: string; rowNumber: number; };

const { product: updatedProduct } = await this.updateProductWithFetch(id, updateProduct)
resolve({ ...updatedProduct, rowNumber });
} else {
isUpdating = false
const { id, rowNumber, ...createProduct } = product as CreateProductInput & { id: string; rowNumber: number; }
const { product: createdProduct } = await this.createProductWithFetch(createProduct);
resolve({ ...createdProduct, rowNumber })
}
} catch (error) {
console.log('\n\n\nAn error occurred!\n', error.response.data, '\n', JSON.stringify(product), '\n', isUpdating);
console.log('An error occurred!\n', error.response.data);
}
} else {
const { id, rowNumber, ...createProduct } = product as CreateProductInput & { id: string, rowNumber: number; }
Expand Down

0 comments on commit 47fca3f

Please sign in to comment.