Connect local write permissions to backend
This commit is contained in:
@@ -13,12 +13,14 @@ import {
|
||||
|
||||
export async function loadManufacturerCatalogState(config, { manufacturerId, position = 1 }) {
|
||||
const refreshResults = [];
|
||||
for (const sql of prepareManufacturerCatalogSqls({ manufacturerId })) {
|
||||
refreshResults.push(
|
||||
await executeEndpointWrite(config, sql, {
|
||||
operation: "catalog-maker-refresh-manufacturer",
|
||||
}),
|
||||
);
|
||||
if (config.database?.mode === "local" && config.database.allowWrites) {
|
||||
for (const sql of prepareManufacturerCatalogSqls({ manufacturerId })) {
|
||||
refreshResults.push(
|
||||
await executeEndpointWrite(config, sql, {
|
||||
operation: "catalog-maker-refresh-manufacturer",
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const productResult = await queryEndpoint(
|
||||
@@ -49,6 +51,7 @@ export async function loadManufacturerCatalogState(config, { manufacturerId, pos
|
||||
refresh: {
|
||||
operation: "catalog-maker-refresh-manufacturer",
|
||||
statements: refreshResults.length,
|
||||
skipped: refreshResults.length === 0,
|
||||
},
|
||||
product: normalizeProduct(product),
|
||||
combinations: combinationsResult.items.map(normalizeCombination),
|
||||
|
||||
Reference in New Issue
Block a user